Issue 98244
Summary [X86] Function multiversioning doesn't consistently handle features with priority=0
Labels new issue
Assignees
Reporter DanShaders
    The following code produces a correctly constructed ifunc resolver:
```cpp
[[gnu::target("sha")]] int f() { return 2; }
[[gnu::target("default")]] int f() { return 1; }

int main() { return f(); }
```

While in the snippet below, Clang either silently ignores the "sha" overload without assertions or ICEs with assertions.
```cpp
[[gnu::target("default")]] int f() { return 1; }
[[gnu::target("sha")]] int f() { return 2; }

int main() { return f(); }
```

CE link: https://godbolt.org/z/Ghzb6KzGf

The buggy behavior arises because "sha" has PRIORITY=0 as defined here:
https://github.com/llvm/llvm-project/blob/7bfb98c34687d9784f36937c3ff3e735698b498a/llvm/include/llvm/TargetParser/X86TargetParser.def#L214

Obviously, this is one of the manifestations of a long-standing issue with `__attribute__((target))` and "unorderable" features, so I'm not sure what the expected behavior is here. However, at the very least, issuing a diagnostic in the cases above will greatly improve DX.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to