[LLVMdev] Deterministic iteration over llvm iterators

Chris Lattner clattner at apple.com
Mon Jan 25 14:27:33 PST 2010

On Jan 26, 2010, at 7:23 AM, Augustine Mathews wrote:

> Forgot cc, the entire group.
> How can deterministically iterate over the uses of a variable. i.e.  
> the uses should be any particular order that doesn't change from  
> execution to execution of the opt tool.
> To make myself more clearer, here is a snippet of code that has  
> Values reordered each time I analyze a particular piece of  
> code(which doesn't change) with the LLVM opt tool and my LLVM pass.

use_iterator should be deterministic.

> Currently this is what happens in principle:
> Execution 1: <val 1> <val 2> <val 3>
> Execution 2: <val 2> <val 1> <val 3>
> The llvm version that I am using llvm 2.5. My machine is an x86 32  
> bit dual core machine.

This was a bug in the LLVM 2.5 bitcode reader which has already been  
fixed, please update to mainline.


More information about the llvm-dev mailing list