[LLVMdev] Module::getOrInsertFunction determinism

Kuchta, Tomasz t.kuchta12 at imperial.ac.uk
Fri May 30 06:04:29 PDT 2014


Hi Tim, 

You’ve mentioned that sometimes the root cause of the problem is that a
pointer or a hash
is used instead of the name in sorting. I thought I will give it a try
with ASLR turned off.
Surprisingly now the output seems to be consistent. As far as I understand
ASLR runs on OS level rather than on the
compiler level, which may suggest that probably somewhere this order of
pointers matters.
I’m using LLVM 2.9 with KLEE symbolic execution engine.

I’m not sure how much this problem is specific to my particular use or
LLVM version though.

Thank you,
Tomek

On 29/05/2014 22:25, "Kuchta, Tomasz" <t.kuchta12 at imperial.ac.uk> wrote:

>Hi Tim,
>
>On 29/05/2014 19:36, "Tim Northover" <t.p.northover at gmail.com> wrote:
>
>>Hi Tomek,
>>
>>On 29 May 2014 19:12, Kuchta, Tomasz <t.kuchta12 at imperial.ac.uk> wrote:
>>> Thank you very much for quick response. What happens in my case is that
>>> mixing calls to getOrInsertFunction with linking another bit code
>>>module to
>>> the current module seems to be sometimes producing different outputs.
>>
>>Even with exactly the same call sequence in each case? That's probably
>>not intended.
>
>Yes, that was for the same code base. However, as I mentioned in my e-mail
>to Philip, this might also
>be related to my outdated version of LLVM - I should check it on some
>newer one to make sure.
>
>>
>>As you say, it makes looking for actual changes difficult; and for
>>purely Clang-related reasons we want link-time optimized binaries to
>>be comparable with "diff" to verify staging works.
>>
>>The usual cause of these issues is something being sorted by pointer
>>or hash rather than name or some other prior order. I can't see any
>>obvious data structures like that in llvm::Module though.
>>
>>> Difference might be with the ordering of functions in the file (I¹m
>>> looking at LLVM IR representation), with numbers
>>> used for constant variables, numbers used in the ³dbg² metadata.
>>
>>Do you mean you're not sure where the difference is there, or that
>>you've seen all of those differences in practice?
>
>I’ve seen different naming for string constants and different ordering of
>functions in the LLVM IR.
>
>>
>>Cheers.
>>
>>Tim.
>
>Thanks a lot,
>Tomek





More information about the llvm-dev mailing list