[llvm] ARM: Start moving runtime libcall configuration out of TargetLowering (PR #142617)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 01:52:46 PDT 2025


mstorsjo wrote:

> > The whole point of doing this is the RuntimeLibcallInfo uses outside of TargetLowering are wrong; they will incorrectly see the default function names which won't actually be used with the target.
> 
> I don't think that matters here. `__rt_sdiv` will end up getting used with this target triple to lower `sdiv` instructions.
> 
> > The test probably needs updating to the correct libcall name
> 
> The libcall name in the test is correct, at least as far as I can tell. The `sdiv` lowers to ` __rt_sdiv` libcall and produces an undefined symbol error if I drop the file defining `__rt_sdiv`:
> 
> ```
> lld-link: error: undefined symbol: __rt_sdiv
> >>> referenced by /home/gha/llvm-project/build/tools/lld/test/COFF/Output/lto-late-arm.ll.tmp.exe.lto.obj:(entry)
> ```
> 
> I am unsure if the LTO infrastructure that figures out what needs to be imported is doing the correct thing here though. I can readd the test/mark it as XFAIL if this is expected to return to the same behavior at some point.

Yeah, this is what's happening now - https://github.com/llvm/llvm-project/blob/a082f665f85b1002ab22af263eeafceca5288657/lld/COFF/Driver.cpp#L2551-L2561 now lists `__rt_sdiv` as a potential libcall, so it gets imported properly before doing LTO.

So the issue that the test exercised no longer exists, at least for these libcalls (perhaps there are other libcalls that can trigger similar issues later?), so I think the right thing to do is to convert this from a negative test to a positive one that tests that this now works as expected. (We do lose test coverage for the error situation though.) I can make a PR for that.

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


More information about the llvm-commits mailing list