[LLVMdev] [llvm-commits] Review Request: Use SmallPtrSetImpl instead of SmallPtrSet in funciton IVUsers::AddUsersIfInteresting

Hongbin Zheng etherzhhb at gmail.com
Fri Mar 16 18:18:49 PDT 2012


hi,


On Sat, Mar 17, 2012 at 2:11 AM, Andrew Trick <atrick at apple.com> wrote:

> Yep. I normally do that. I was under some strange impression last night that SmallPtrSetImpl wasn't a template.
The patch is incorrect because the SmallPtrSetImpl is neither a
template nor has an "insert" function...

After a detailed look at the header of SmallPtrSet, I found that the
SmallPtrSetImpl has an "insert_imp" function which accepts void
pointer as argument, and the "insert" function in SmallPtrSet simply
cast the incoming pointer to void* by the
"PtrTraits::getAsVoidPointer" function and pass the void pointer to
insert_imp.

So I wonder can we make SmallPtrSetImpl become a template just like
SmallVectorImpl? After that we can move insert/erase/count from
SmallPtrSet to SmallPtrSetImpl, and users can pass a
SmallPtrSetImpl<T> as argument instead of pass something like
SmallPtrSet<T, 100>.

> Please check in, and you can simultaneously fix the polly branch.
Temporary fixed by passing a dummy set.
>
> Incidentally, the only reason I didn't hide the SmallPtrSet argument behind the API is that all the callers outside IVUsers will be removed from the codebase soon.
So which function is supposed to call by outside caller?
>
> -Andy

best regards
ether



More information about the llvm-dev mailing list