[all-commits] [llvm/llvm-project] 6662fe: [X86] Add missing vNbf16 handling in X86CallingCon...

Mikołaj Piróg via All-commits all-commits at lists.llvm.org
Tue Feb 18 19:04:32 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6662fe393cab2c4e550002c276813a89d9ab4443
      https://github.com/llvm/llvm-project/commit/6662fe393cab2c4e550002c276813a89d9ab4443
  Author: Mikołaj Piróg <mikolaj.maciej.pirog at intel.com>
  Date:   2025-02-19 (Wed, 19 Feb 2025)

  Changed paths:
    M llvm/lib/Target/X86/X86CallingConv.td
    A llvm/test/CodeGen/X86/bfloat-calling-conv.ll

  Log Message:
  -----------
  [X86] Add missing vNbf16 handling in X86CallingConv.td file (#127102)

Lack of these entries caused clang to crash on the following code:

```c
__m256bh fun(__m256bh arg) {
	return arg;
	
}
__m256bh run() {
    __m256bh arg= {0};
    fun(arg);
}
```
It caused the FastISel to fail since it handled the call lowering basing
on the X86CallingConv table.

Curiously, if FastISel fails somewhere down the line and
selectionDAGISel fallbacks, the crash does not occur. Following code
_does not_ crash:

```c
__m256bh fun(__m256bh arg) {
	return arg;
}

__m256bh run() {
    __m256bh arg= {0};
    return fun(arg);

}
```

This is puzzling to me. Obviously, if FastISel fails then compiler
fallbacks to something else to lower these calls -- but since the
X86callingConv table _doesn't_ have entries for vNbf16 how does this
other thing manage not to crash? It has to use some other mechanism, one
which doesn't use the table. This rises following questions:
- how is this lowering accomplished without, presumably, using the
CallingConv entries?
- why is the table not used? I mean this points to some logic
duplication (fastISel way vs. the other bug-free way)
- How to properly test this? There is a test for vNbf16 values, but it
also must not be using the FastISel path? This duplication of logic
makes it hard to test this, since we don't have direct control whether
the FastISel path or the other one is used.

Nonetheless, this PR fixes the crash, though I didn't create a test for
it, since I am unsure yet how it should look like. I would like to learn
how the working non-FastISel mechanism works; I tried looking for it,
but didn't yet manage to find anything



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list