[LLVMdev] How to replace a global variable to one with a different type?

Talin viridia at gmail.com
Fri Feb 4 01:10:14 PST 2011


I'm experimenting with "replaceAllUsesWith" and I see that it requires that
the replacement be the same type.

Here's what I am trying to do: Say I have a global variable A whose type is
[10 x Foo]. The only references to A are via GEPs which get a pointer to the
first element: GEP(A, 0, 0), so in other words no user of A knows the length
of the array from the type.

Now I want to replace A with A', which is exactly the same except that it
has a different array length. I want to remove all references to the
original A. I can't use replaceAllUsesWith, because A and A' have different
types.

-- 
-- Talin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110204/5ce9b6b7/attachment.html>


More information about the llvm-dev mailing list