[llvm] [FastIsel] Get the right register type for call instruction (PR #164565)
Luo Yuanke via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 22 19:11:10 PDT 2025
================
@@ -1977,8 +1977,13 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
if (const Instruction *Inst = dyn_cast<Instruction>(V)) {
Register InReg = FuncInfo.InitializeRegForValue(Inst);
+ std::optional<CallingConv::ID> CallConv;
+ auto *CI = dyn_cast<CallInst>(Inst);
----------------
LuoYuanke wrote:
I try to create a test case for `callbr`, but I got llc crash with below case. It seems x86 don't support half or bfloat type in inline assembly.
```
define half @test1(float %x) {
entry:
%ret = callbr half asm "vxorps $1, $1, $0 jmp ${2:l}", "=x,x,!i"(float %x)
to label %normal [label %abnormal]
normal:
ret half %ret
abnormal:
ret half 1.0
}
```
error: couldn't allocate output register for constraint 'x'
I also got llc crash when running below test case for `invoke`.
```
declare bfloat @pers(...)
declare bfloat @foo();
define bfloat @test_lp() personality ptr @pers {
entry:
%1 = invoke bfloat @foo()
to label %then unwind label %hotlp
then:
ret bfloat %1
hotlp:
%2 = landingpad { ptr, bfloat }
cleanup
br label %lpret
lpret:
%3 = extractvalue { ptr, bfloat } %2, 1
ret bfloat %3
}
```
So I'd like to keep it as `CallInst` for now. When bfloat is better supported in `callbr` and `invoke`, we can review `CallInst` and support more call-alike instruction.
https://github.com/llvm/llvm-project/pull/164565
More information about the llvm-commits
mailing list