<div dir="ltr">Any one can shed some light on this? I still cannot figure a principled way to interpret the error msg. Thanks a lot.<div><br></div><div>Best,</div><div>Irene</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 14, 2018 at 3:50 PM div code <<a href="mailto:divsubmission@gmail.com">divsubmission@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hello Philip,<div><br></div><div>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.. </div><div><br></div><div>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.</div><div><br></div><div><br></div><div><pre style="margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;background-color:rgb(239,240,241);color:rgb(36,39,41)"><pre style="margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit">  %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
</code><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit"><b>  call void @test.check(i64* %gas.ptr, i64 %14, i8* %jmpBuf)
  %15 = call i256 @test.udiv.i256(i256 %10, i256 1) <-- this seems fine</b></code><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit">


  ...
  %20 = call i256 @llvm.bswap.i256(i256 %msg.value)
</code><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit"><b>  %21 = mul i256 %20, 190
  %22 = call i256 @test.udiv.i256(i256 %21, i256 100) <--- this cause the issue for llc 3.8.1
</b></code><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit">
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
}</code></pre></pre></div><div><br></div><div>I tried to tweak the buggy lines into the following code, and it can also pass the compilation:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;background-color:rgb(239,240,241);color:rgb(36,39,41)"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit">
  %20 = call i256 @llvm.bswap.i256(i256 %msg.value)
  %21 = call i256 @test.udiv.i256(i256 %20, i256 100)</code></pre></div><div><br></div><div>This seems really wired to me.. Any idea on that? Thank you!</div><div><br></div><div>Best,</div><div>Irene</div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 14, 2018 at 1:20 PM Philip Pfaffe <<a href="mailto:philip.pfaffe@gmail.com" target="_blank">philip.pfaffe@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Irene,<div><br></div><div>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.</div><div><br></div><div>Cheers,</div><div>Philip</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 14, 2018 at 11:27 AM div code via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>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.</div><div><br></div><div>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:</div><div><br></div><div>LLVM ERROR: Unsupported library call operation! </div><div><br></div><div>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. </div><div><br></div><div>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.</div><div><br></div><div>Best,</div><div>Irene </div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>