<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
The generated code is deterministic, but the global order the instructions were generated <br>seems it is not (although the result is guaranteed to be the same). <br>Now I think the order functions are processed might not be guaranteed.<br>I've attached a test case, and here is what I get:<br>...............................<br> (303)$ ~/bin/llvm/bin/gcc -O3 -emit-llvm try_calls_basic.2.c -c -o try_calls_basic2.bc<br> (304)$  $LLVM/opt  -O3 -IR-DUMP :ALL -load ~/download/llvm-objects/Debug/lib/LLVMHello.so -hello  -debug-pass Structure < try_calls_basic2.bc > try_calls_basic2.2.bc 2> x1<br> (305)$  $LLVM/opt  -O3 -IR-DUMP :ALL -load ~/download/llvm-objects/Debug/lib/LLVMHello.so -hello  -debug-pass Structure < try_calls_basic2.bc > try_calls_basic2.2.bc 2> x2<br> (306)$ diff x1 x2|more<br>237c237<br><       %0 = tail call i32 (...)* %pf() nounwind                ; <i32> [#uses=0] {vuid=69}<br>---<br>>       %0 = tail call i32 (...)* %pf() nounwind                ; <i32> [#uses=0] {vuid=56}<br>....................................<br>(The -IR-DUMP :ALL is a debugging option I use, that dumps the IR after each function pass  in FPPassManager::runOnFunction)<br><br>The vuid are different (69!=56). <br>In fact a closer examination shows that the 56-th Value in the first case is <br>an instruction in main, while in the 2nd case is an instruction in a different function.<br><br>My particular issue is that I want to see when the following instruction is created:<br>    %pf1.0 = select i1 %0, i32 (...)* bitcast (i32 ()* @pointed_to_function1 to i32 (...)*), i32 (...)* bitcast (i32 ()* @pointed_to_function2 to i32 (...)*)        ; <i32 (...)*> [#uses=2] {vuid=67}<br><br>So, I assume it is the 67-th Value, set a conditional breakpoint and restart the program. <br>But this fails, because the second time it is the 55-th value created:<br>    %pf1.0 = select i1 %0, i32 (...)* bitcast (i32 ()* @pointed_to_function1 to i32 (...)*), i32 (...)* bitcast (i32 ()* @pointed_to_function2 to i32 (...)*)        ; <i32 (...)*> [#uses=2] {vuid=55}<br><br><br>The issues seems to go away, if I remove all other functions from the file and only keep the function I am interested in.<br><br>Thank you,<br>Daniel<br><br><br>> Date: Tue, 19 May 2009 10:59:35 -0700<br>> From: isanbard@gmail.com<br>> To: llvmdev@cs.uiuc.edu<br>> Subject: Re: [LLVMdev] how to get a deterministic execution<br>> <br>> On Mon, May 18, 2009 at 8:33 PM, dan mihai <dnmh68@hotmail.com> wrote:<br>> > Hello,<br>> ><br>> Yo!<br>> <br>> > For debugging purposes, I've added a unique id member to the Value class:<br>> ><br>> > global_next_vuid = 0;<br>> > Value::Value(..){<br>> >   vuid = ++global_next_vuid;<br>> > }<br>> ><br>> > My hope is that by looking at the vuid of a Value, I can see its vuid,<br>> > set a conditional breakpoint and re-run the compiler to<br>> > see who (what pass) constructed that value.<br>> ><br>> > Maybe I am not doing it the right way, but the above 'vuid' field doesn't<br>> > seem<br>> > to be updated deterministically.<br>> ><br>> We'd need a testcase to see what you mean...I'm not entirely sure that<br>> what you're doing will work, though.<br>> <br>> > I am using a DEBUG built. Is LLVM multithreaded by default?<br>> ><br>> No. LLVM isn't multithreaded safe just yet.<br>> <br>> > Is it possible to get a deterministic behavior?<br>> ><br>> The code that's generated should be completely deterministic.<br>> <br>> -bw<br>> <br>> _______________________________________________<br>> LLVM Developers mailing list<br>> LLVMdev@cs.uiuc.edu         http://llvm.cs.uiuc.edu<br>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev<br><br /><hr />Insert movie times and more without leaving HotmailŪ. <a href='http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009' target='_new'>See how.</a></body>
</html>