================ @@ -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() ---------------- labrinea wrote:
> You don't actually have any code that proves that the caller8.* definitions > are related, as far as I can tell. The callers follow the mangling rules as defined by the ACLE https://arm-software.github.io/acle/main/acle.html#name-mangling. Clang is responsible for generating those correctly, that's why I originally added the integration test in `clang/test/CodeGen/AArch64/fmv-explicit-priority.c` compiled with `-O3` so that `GlobalOpt` is tested there. Oh wait! You are saying GlobalOpt itself is not checking that the callers are associated with each other (https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/IPO/GlobalOpt.cpp#L2572), like it does for callees (https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/IPO/GlobalOpt.cpp#L2548). Ouch! Thanks for catching this, it is indeed an issue we have to fix, unrelated to this patch. > The testcase is confusing because it seems to assume that sve2 doesn't imply > sve. I am not sure I am following. Please elaborate. Perhaps you are asking why caller8._MmopsMsve2 calls test_explicit_priority._Msve2 instead of test_explicit_priority._Msve? Because originally in ACLE an FMV feature has higher priority than the features it implies, but we are bending this rule with the explicit override. Hmm, good point, not sure how to properly deal with this. Maybe the algorithm needs adjustment. > What happens if priorities aren't in the same order? Just sorting based on > the priority means the FeatureMasks aren't sorted, so I'm not sure just > iterating over the callers works the way you want it to if the priorities are > reversed. Is this the same issue as the previous bulletpoint, or do you mean something else? You mean that the premise https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/IPO/GlobalOpt.cpp#L2618 no longer holds? For example caller8._Mmops should be calling test_explicit_priority._Mmops on the basis that since caller8._Msve was not selected it means sve2 is also unavailable so test_explicit_priority._Msve2 ought to be skipped? 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