[llvm-dev] A strange problem about type i64 for LLVM

Qiuping Yi via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 12 08:10:15 PDT 2017


Hello, everyone,

I encounter a strange problem about llvm type i64 and C++ type int64_t.

I instrumented a program to call the function 'myFunction' in the C++
shared library. 'myFunction' is something like this:

int64_t myFunction() {
     int64_t retValue;
     ...
     std::cout << "retValue: " << retValue << "\n";
     return retValue;
}

The call instruction in llvm bytecode is something like this:

%0 = call i64 myFunction();

However, I found retValue in 'myFunction' have a different value with %0.
For exmple, when 'retValue' got '140583176769504', '%0' got '306205760'. I
found '306205760' is the result of truncate int64_t '140583176769504' to
int32_t. But how this happens, because %0 also has the type of i64. Or type
i64 actually doesn't correspond to int64_t? If so, how can I represent
int64_t in llvm?

Thanks in advance.



Best regards,

Qiuping Yi
Parasol Laboratory
Department of Computer Science and Engineering
Texas A&M University
College Station
TX 77843
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170712/b23347fc/attachment.html>


More information about the llvm-dev mailing list