[LLVMdev] Removal of ConstantExprs
matthijs at stdin.nl
Tue Jun 24 10:58:00 PDT 2008
> We can't "garbage collect" ConstantExprs at arbitrary points: they may
> exist in maps, in local variables etc. There is no good way to know they
> are dead.
Ah, makes sense.
> > Also, in this case I'm using a bitcast of A, but what if this was a bitcast of
> > a gep of a A? In this case, removeDeadConstantUsers on A would not remove
> > anything, since the GEP is still used by the bitcast.
> removeDeadConstantUsers removes both of them. Existing clients call
> removeDeadConstantUsers and then recheck to see if the use count is zero.
> If not, there was some real user that can't be removed.
Ah, in that case, I should just modify my pass to call removeDeadConstantUsers
before inspecting the global.
> > AFAICS this kind of thing should be triggered when the use is removed (ie,
> > when the initializer is set to 0). I was however unable to find the
> > implementation of Use::set(), which seems to be closely related. Does anyone
> > know where it is (grepping for "set" didn't prove so fruitful...)?
> I'm not sure what you mean here
I was just following the code that is related to this stuff, and couldn't find
the implementation of Use::set(). It's declared in Use.h but not implemented
there, nor in Use.cpp. Anyway, considering the above, this is no longer
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: Digital signature
More information about the llvm-dev