[LLVMdev] constantexpr problem (original) (raw)

Duncan Sands baldrick at free.fr
Fri Sep 23 09:09:33 PDT 2011


Hi Tsingray,

I have got a problem when I used the useempty() member function while I used a global variable. I erase all the instructions which will use a global variable. Then I called the useempty() 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.



More information about the llvm-dev mailing list