-
Notifications
You must be signed in to change notification settings - Fork 14k
[FMV][AArch64] Do not emit ifunc resolver on use. #97761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -o - %s | FileCheck %s | ||
|
||
// CHECK: @used_before_default_def = weak_odr ifunc void (), ptr @used_before_default_def.resolver | ||
// CHECK: @used_after_default_def = weak_odr ifunc void (), ptr @used_after_default_def.resolver | ||
// CHECK-NOT: @used_before_default_decl = weak_odr ifunc void (), ptr @used_before_default_decl.resolver | ||
// CHECK-NOT: @used_after_default_decl = weak_odr ifunc void (), ptr @used_after_default_decl.resolver | ||
// CHECK-NOT: @used_no_default = weak_odr ifunc void (), ptr @used_no_default.resolver | ||
// CHECK-NOT: @not_used_no_default = weak_odr ifunc void (), ptr @not_used_no_default.resolver | ||
// CHECK: @not_used_with_default = weak_odr ifunc void (), ptr @not_used_with_default.resolver | ||
|
||
|
||
// Test that an ifunc is generated and used when the default | ||
// version is defined after the first use of the function. | ||
// | ||
__attribute__((target_version("aes"))) void used_before_default_def(void) {} | ||
// CHECK-LABEL: define dso_local void @used_before_default_def._Maes( | ||
// | ||
void call_before_def(void) { used_before_default_def(); } | ||
// CHECK-LABEL: define dso_local void @call_before_def( | ||
// CHECK: call void @used_before_default_def() | ||
// | ||
__attribute__((target_version("default"))) void used_before_default_def(void) {} | ||
// CHECK-LABEL: define dso_local void @used_before_default_def.default( | ||
// | ||
// CHECK-NOT: declare void @used_before_default_def( | ||
|
||
|
||
// Test that an ifunc is generated and used when the default | ||
// version is defined before the first use of the function. | ||
// | ||
__attribute__((target_version("aes"))) void used_after_default_def(void) {} | ||
// CHECK-LABEL: define dso_local void @used_after_default_def._Maes( | ||
// | ||
__attribute__((target_version("default"))) void used_after_default_def(void) {} | ||
// CHECK-LABEL: define dso_local void @used_after_default_def.default( | ||
// | ||
void call_after_def(void) { used_after_default_def(); } | ||
// CHECK-LABEL: define dso_local void @call_after_def( | ||
// CHECK: call void @used_after_default_def() | ||
// | ||
// CHECK-NOT: declare void @used_after_default_def( | ||
|
||
|
||
// Test that an unmagled declaration is generated and used when the | ||
// default version is declared after the first use of the function. | ||
// | ||
__attribute__((target_version("aes"))) void used_before_default_decl(void) {} | ||
// CHECK-LABEL: define dso_local void @used_before_default_decl._Maes( | ||
// | ||
void call_before_decl(void) { used_before_default_decl(); } | ||
// CHECK-LABEL: define dso_local void @call_before_decl( | ||
// CHECK: call void @used_before_default_decl() | ||
// | ||
__attribute__((target_version("default"))) void used_before_default_decl(void); | ||
// CHECK: declare void @used_before_default_decl() | ||
|
||
|
||
// Test that an unmagled declaration is generated and used when the | ||
// default version is declared before the first use of the function. | ||
// | ||
__attribute__((target_version("aes"))) void used_after_default_decl(void) {} | ||
// CHECK-LABEL: define dso_local void @used_after_default_decl._Maes( | ||
// | ||
__attribute__((target_version("default"))) void used_after_default_decl(void); | ||
// CHECK: declare void @used_after_default_decl() | ||
// | ||
void call_after_decl(void) { used_after_default_decl(); } | ||
// CHECK-LABEL: define dso_local void @call_after_decl( | ||
// CHECK: call void @used_after_default_decl() | ||
|
||
|
||
// Test that an unmagled declaration is generated and used when | ||
// the default version is not present. | ||
// | ||
__attribute__((target_version("aes"))) void used_no_default(void) {} | ||
// CHECK-LABEL: define dso_local void @used_no_default._Maes( | ||
// | ||
void call_no_default(void) { used_no_default(); } | ||
// CHECK-LABEL: define dso_local void @call_no_default( | ||
// CHECK: call void @used_no_default() | ||
// | ||
// CHECK: declare void @used_no_default() | ||
|
||
|
||
// Test that neither an ifunc nor a declaration is generated if the default | ||
// definition is missing since the versioned function is not used. | ||
// | ||
__attribute__((target_version("aes"))) void not_used_no_default(void) {} | ||
// CHECK-LABEL: define dso_local void @not_used_no_default._Maes( | ||
// | ||
// CHECK-NOT: declare void @not_used_no_default( | ||
|
||
|
||
// Test that an ifunc is generated if the default version is defined but not used. | ||
// | ||
__attribute__((target_version("aes"))) void not_used_with_default(void) {} | ||
// CHECK-LABEL: define dso_local void @not_used_with_default._Maes( | ||
// | ||
__attribute__((target_version("default"))) void not_used_with_default(void) {} | ||
// CHECK-LABEL: define dso_local void @not_used_with_default.default( | ||
// | ||
// CHECK-NOT: declare void @not_used_with_default( | ||
|
||
|
||
// CHECK: define weak_odr ptr @used_before_default_def.resolver() | ||
// CHECK: define weak_odr ptr @used_after_default_def.resolver() | ||
// CHECK-NOT: define weak_odr ptr @used_before_default_decl.resolver( | ||
// CHECK-NOT: define weak_odr ptr @used_after_default_decl.resolver( | ||
// CHECK-NOT: define weak_odr ptr @used_no_default.resolver( | ||
// CHECK-NOT: define weak_odr ptr @not_used_no_default.resolver( | ||
// CHECK: define weak_odr ptr @not_used_with_default.resolver() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -261,9 +261,9 @@ __attribute__((target_version("jscvt"))) int default_def_with_version_decls(void | |
// CHECK: attributes #[[ATTR3]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+lse,-v9.5a" } | ||
// CHECK: attributes #[[ATTR4]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon,+rdm,-v9.5a" } | ||
// CHECK: attributes #[[ATTR5:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+dotprod,+fp-armv8,+neon,-v9.5a" } | ||
// CHECK: attributes #[[ATTR6:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+jsconv,+neon,-v9.5a" } | ||
// CHECK: attributes #[[ATTR7:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-v9.5a" } | ||
// CHECK: attributes #[[ATTR8:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+lse,-v9.5a" } | ||
// CHECK: attributes #[[ATTR6:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-v9.5a" } | ||
// CHECK: attributes #[[ATTR7:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+lse,-v9.5a" } | ||
// CHECK: attributes #[[ATTR8:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+jsconv,+neon,-v9.5a" } | ||
Comment on lines
+264
to
+266
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These attributes are not actually matched against anything, is there any point testing them? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the intention is to check that we are correctly enabling the FMV implied features. If those are fully covered in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way do you know how to disable the attribute checks? |
||
//. | ||
// CHECK-NOFMV: attributes #[[ATTR0]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-fmv" } | ||
//. | ||
|
Uh oh!
There was an error while loading. Please reload this page.