Hi all, I have got a problem when I used the use_empty() member function while I used a global variable. I erase all the instructions which will use a global variable. Then I called the use_empty() on that global variable. I got no empty because a constantexpr use the global variable. I wonder whether there is any way to erase the constantexpr which is useless to me but occupying the global variable. best regard! yours. Tsingray -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110923/44b520a3/attachment.html>
Hi Tsingray,> I have got a problem when I used the use_empty() member function while I > used a global variable. I erase all the instructions which will use a global > variable. Then I called the use_empty() on that global variable. I got no empty > because a constantexpr use the global variable. I wonder whether there is any > way to erase the constantexpr which is useless to me but occupying the global > variable.if G is your global variable, do G->replaceAllUsesWith(UndefValue::get(G->getType())); to replace G with undef in all users of G. You can then safely delete G. Ciao, Duncan.
On 09/23/2011 07:27 AM, tsingray liu wrote:> Hi all, > I have got a problem when I used the use_empty() member function > while I used a global variable. I erase all the instructions which will > use a global variable. Then I called the use_empty() on that global > variable. I got no empty because a constantexpr use the global variable. > I wonder whether there is any way to erase the constantexpr which is > useless to me but occupying the global variable. > best regard!GV->removeDeadConstantUsers(); Nick
Possibly Parallel Threads
- [LLVMdev] Use still stuck around after Def is destroyed:
- [LLVMdev] Use still stuck around after Def is destroyed:
- [LLVMdev] Removal of ConstantExprs
- InstCombine doesn't delete instructions with token
- [LLVMdev] GlobalVariable initializer using from beyond the grave