[llvm] [FastIsel] Get the right register type for call instruction (PR #164565)

Luo Yuanke via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 23 01:05:00 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 created a PR https://github.com/llvm/llvm-project/pull/164769, but it is difficult to create a test case. And it seems another bug can be caught in below test.
```
declare i32 @pers(...)
declare bfloat @foo();

define i32 @test_lp() personality ptr @pers {
entry:
  %1 = invoke bfloat @foo()
          to label %then unwind label %hotlp

then:
  %call = call i32 @bar2(bfloat %1)
  ret i32 %call

hotlp:
  %2 = landingpad { ptr, i32 }
          cleanup
  br label %lpret

lpret:
  %3 = extractvalue { ptr, i32 } %2, 1
  ret i32 %3
}

declare i32 @bar2(bfloat)
```

https://github.com/llvm/llvm-project/pull/164565


More information about the llvm-commits mailing list