Pointer becomes NULL immediately
<p>I have the following LLVM code. The strange thing is that the <code>si</code> variable of type <code>StoreInst</code> becomes null(0) immediately after it is allocated with new instruction outside the if block, whereas I have declared it at an outer scope. What is going on here?</p>

<pre><code>        Value *OldVal = NULL;
        StoreInst* si = NULL;

        if ( ... )
        {
            if ( ... )
            {
                ....

                if ( ... )
                {
                    ...
                    StoreInst* si = new StoreInst(...);
                    errs() &lt;&lt; "si = " &lt;&lt; si &lt;&lt; "\n"; // Get some address here
                }
                errs() &lt;&lt; "--&gt;SI = " &lt;&lt; si &lt;&lt; "\n"; // Here I get NULL, why?
            }
            ...
        }
</code></pre>

<p>I get an output like this,</p>

<pre><code>si = 0x1822ba0
--&gt;SI = 0x0
</code></pre>
