[LLVMdev] mem2reg Question

Eli Friedman eli.friedman at gmail.com
Fri Sep 19 17:21:53 PDT 2008


On Fri, Sep 19, 2008 at 3:28 PM, David Greene <dag at cray.com> wrote:
> Ok, so you're saying that because we're storing a global value, by
> definition it DOES dominate the use because it's a global (and
> thus live-in to the Function).  Is that right?

Yes.

> But why is it any different if the stored value is from an instruction?  We're
> storiung some value into an alloca (under a condition in this case) and the
> alloca later gets used in a place not dominated by the store (outside the
> condition in this case).  Who cares where the value being stored came from?

The issue isn't really whether the store dominates the use, but
whether the value being stored dominates the use.  The code is correct
because dominance is transitive; since the store dominates the use,
the value stored must also dominate the use.

-Eli



More information about the llvm-dev mailing list