================ @@ -348,6 +350,76 @@ entry: ret i32 %call } +declare i32 @test_explicit_priority._Mmops() #18 +declare i32 @test_explicit_priority._Msve2() #19 +declare i32 @test_explicit_priority._Msve() #20 +declare i32 @test_explicit_priority.default() #0 + +define weak_odr ptr @test_explicit_priority.resolver() comdat { +; CHECK-LABEL: define weak_odr ptr @test_explicit_priority.resolver() comdat { +resolver_entry: + tail call void @__init_cpu_features_resolver() + %0 = load i64, ptr @__aarch64_cpu_features, align 8 + %1 = and i64 %0, 1073807616 + %2 = icmp eq i64 %1, 1073807616 + br i1 %2, label %common.ret, label %resolver_else + +common.ret: ; preds = %resolver_else2, %resolver_else, %resolver_entry + %common.ret.op = phi ptr [ @test_explicit_priority._Msve, %resolver_entry ], [ @test_explicit_priority._Msve2, %resolver_else ], [ %test_explicit_priority._Mmops.test_explicit_priority.default, %resolver_else2 ] + ret ptr %common.ret.op + +resolver_else: ; preds = %resolver_entry + %3 = and i64 %0, 69793284352 + %4 = icmp eq i64 %3, 69793284352 + br i1 %4, label %common.ret, label %resolver_else2 + +resolver_else2: ; preds = %resolver_else + %5 = and i64 %0, 576460752303423488 + %.not = icmp eq i64 %5, 0 + %test_explicit_priority._Mmops.test_explicit_priority.default = select i1 %.not, ptr @test_explicit_priority.default, ptr @test_explicit_priority._Mmops + br label %common.ret +} + +define i32 @caller8._MmopsMsve2() #21 { +; CHECK-LABEL: define i32 @caller8._MmopsMsve2( +; CHECK-SAME: ) local_unnamed_addr #[[ATTR20:[0-9]+]] { +; CHECK: [[CALL:%.*]] = tail call i32 @test_explicit_priority._Msve2() +; +entry: + %call = tail call i32 @test_explicit_priority() + ret i32 %call +} + +define i32 @caller8._Mmops() #22 { +; CHECK-LABEL: define i32 @caller8._Mmops( +; CHECK-SAME: ) local_unnamed_addr #[[ATTR21:[0-9]+]] { +; CHECK: [[CALL:%.*]] = tail call i32 @test_explicit_priority() +; +entry: + %call = tail call i32 @test_explicit_priority() + ret i32 %call +} + +define i32 @caller8._Msve() #23 { +; CHECK-LABEL: define i32 @caller8._Msve( +; CHECK-SAME: ) local_unnamed_addr #[[ATTR22:[0-9]+]] { +; CHECK: [[CALL:%.*]] = tail call i32 @test_explicit_priority._Msve() +; +entry: + %call = tail call i32 @test_explicit_priority() ---------------- efriedma-quic wrote:
I don't understand what's happening here. The semantics of a call shouldn't depend on whether the caller is multiversioned; the caller should have a target-features attribute, and the optimization should check those target features. In other words, the following two examples should have the same semantics: ``` void caller8() __attribute((target_version("sve,priority=100"))) { test_explicit_priority(); } ``` ``` static inline void wrapper() __attribute((target("sve"))) { test_explicit_priority(); } void caller8() __attribute((target_version("sve,priority=100"))) { wrapper(); } ``` Given that, we should never statically select the "sve" version, when better versions exist. https://github.com/llvm/llvm-project/pull/150267 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits