[LLVMdev] Copy Instructions?
Eli Friedman
eli.friedman at gmail.com
Tue Jan 27 16:28:12 PST 2009
On Tue, Jan 27, 2009 at 2:54 PM, David Greene <dag at cray.com> wrote:
> How do I go about creating the copy t = x? I don't want to use an add with a
> zero constant because it may not be optimized in all circustations (floating
> point, for example).
You can use a no-op bitcast for scalars, but there isn't any reliable
way to do it for all first-class values. That said, I don't quite
follow the issue. This is SSA, so the only way a value can change is
if you change the code.
I'm not really following what the issue is in this testcase, though,
so I could be missing something. The way you're describing it,
mem2reg appears to be working as intended; the correct completion is
in fact as follows:
// x = phi(x.0, expr)
// y = phi(y.0, x)
> In this particular example another solution would be to reorder the phis but I
> don't think that will work in the general case.
PHI nodes don't have an ordering, at least conceptually; they're not
real instructions.
-Eli
More information about the llvm-dev
mailing list