[llvm-dev] LLVM Error: Unsupported library call operation
div code via llvm-dev
llvm-dev at lists.llvm.org
Fri Dec 14 06:50:39 PST 2018
Hello Philip,
Thank you so much for the info. These legacy LLVM IR code is not produced
on my side so I don't even know the version of the compiler they use..
I tried to do some "delta debugging" and eventually locate the buggy line
of the code. So as shown below, the following code cause llc (version
3.8.1) throws the "Unsupported library call operation" issue, but it works
fine for llc version 3.9.
%10 = call i256 @llvm.bswap.i256(i256 %9)
%11 = call i256 @llvm.ctlz.i256(i256 0, i1 false)
%lz22 = trunc i256 %11 to i64
%sigBits23 = sub i64 256, %lz22
%12 = add i64 %sigBits23, 7
%13 = udiv i64 %12, 8
%14 = mul nuw i64 %13, 10* call void @test.check(i64* %gas.ptr, i64
%14, i8* %jmpBuf)
%15 = call i256 @test.udiv.i256(i256 %10, i256 1) <-- this seems fine*
...
%20 = call i256 @llvm.bswap.i256(i256 %msg.value)* %21 = mul i256 %20, 190
%22 = call i256 @test.udiv.i256(i256 %21, i256 100) <--- this cause
the issue for llc 3.8.1
*
define private i256 @test.udiv.i256(i256 %x, i256 %y) {
%1 = call <2 x i256> @evm.udivrem.i256(i256 %x, i256 %y)
%2 = extractelement <2 x i256> %1, i64 0
ret i256 %2
}
I tried to tweak the buggy lines into the following code, and it can also
pass the compilation:
%20 = call i256 @llvm.bswap.i256(i256 %msg.value)
%21 = call i256 @test.udiv.i256(i256 %20, i256 100)
This seems really wired to me.. Any idea on that? Thank you!
Best,
Irene
On Fri, Dec 14, 2018 at 1:20 PM Philip Pfaffe <philip.pfaffe at gmail.com>
wrote:
> Hi Irene,
>
> the error means that the IR contains a call to a runtime library function
> that the backend doesn't know as of 3.8. You probably created the IR with a
> different llvm version than tha.
>
> Cheers,
> Philip
>
> On Fri, Dec 14, 2018 at 11:27 AM div code via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> Hello,
>>
>> I am on the hook to instrument a piece of legacy LLVM IR code, and then
>> we are planning to feed to the SeaHorn framework for some model checking
>> tasks.
>>
>> After the instrumentation, I tried to use llc (version 3.9) to compile
>> the IR code, and it works fine. However, when I try to use llc (version
>> 3.8.1, the default llvm version of SeaHorn) to compile the IR code, it
>> shows the following error:
>>
>> LLVM ERROR: Unsupported library call operation!
>>
>> I can dig into the IR code and do some "alpha debugging" to see which
>> part of the IR leads to such issue; however, our legacy code is quite large
>> so it could take a while.. Also, I really have no idea on what is "library
>> call operation".. Does it mean some external declared functions? In the IR
>> code we have quite a lot of that.
>>
>> So could anyone shed some light on this? What would be the general cause
>> of this issue? Thank you. Any advice or suggestions would be appreciated.
>>
>> Best,
>> Irene
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181214/08718c68/attachment.html>
More information about the llvm-dev
mailing list