<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/73106>73106</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Need support for variadic functions on X86 GISel path
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MalaySanghiIntel
</td>
</tr>
</table>
<pre>
We are working towards enhancing support for GISel on X86 https://discourse.llvm.org/t/rfc-globalisel-support-for-x86/73424
One of the missing capabilities is variadic functions. X86 bails out of GISel when it sees a variadic function.
Consider C example : https://godbolt.org/z/nEMMEWoYn
and the corresponding llvm IR example: https://godbolt.org/z/PP8rvsfKf
(The flag -mllvm -global-isel-abort=1 seems to have been ignored by clang, so recreated the issue using IR)
Stack dump:
LLVM ERROR: unable to lower arguments: ptr (in function: get_sum)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -march=x86 -global-isel <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'IRTranslator' on function '@get_sum'
#0 0x0000000003150508 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3150508)
#1 0x000000000314de7c SignalHandler(int) Signals.cpp:0:0
#2 0x00007f0d0f022420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f0d0eae500b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f0d0eac4859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00000000006a3da6 llvm::RISCVISAInfo::updateImplication() (.cold) RISCVISAInfo.cpp:0:0
#6 0x000000000353d132 (/opt/compiler-explorer/clang-trunk/bin/llc+0x353d132)
#7 0x0000000003559ec7 llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3559ec7)
#8 0x000000000254cf20 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#9 0x0000000002a44df2 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2a44df2)
#10 0x0000000002a44f71 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2a44f71)
#11 0x0000000002a46bf0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2a46bf0)
#12 0x000000000076c2d0 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#13 0x00000000006ae94a main (/opt/compiler-explorer/clang-trunk/bin/llc+0x6ae94a)
#14 0x00007f0d0eac6083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#15 0x00000000007642fe _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x7642fe)
Program terminated with signal: SIGSEGV
Compiler returned: 139
Relevant source:
`bool X86CallLowering::lowerFormalArguments(...
...
// TODO: handle variadic function
if (F.isVarArg())
return false;
`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0l1tv47oRxz8N_TKwQVOyLg9-8Cbx1uimCezFnvbJGEmUxC5FCiSVOP30BSXZsZIcYM-mDXJRaOk_v7lwNERrRaU4X5PVF7K6nWHnam3W9yjx5YCqqsVOOS5nmS5e1n9wQMPhWZufQlXg9DOawgJXNarcr9iubbVxUGoDX3cHLkEr-GcSQe1ca0mwIWxL2LYQNtedsXwh5VOz0KYibOsI25oyn1dSZyiF5XI-ys1LbeanJCJsGwchCwm9JXQz_H5QHHQJrubQCGs9RI4tZkIKJ7gFYeEJjcBC5FB2KndCK7vomTIU0oLunBcYaJ9rrkA4sJxbwPdPLq5N32hlRcEN3AA_YdNKDiTYvHG10kWmpRt9_A9hW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