Yes walk using a hashtable saying you already walked the tree.
walk_tree_without_duplicates is what you want.
Well, sure, but most callers don't use that. I thought of making a
call to that instead of walk_tree at the TREE_TYPE for POINTER_TYPE
location if htab is zero, but that sounds costly and I'd rather not
if I can avoid it.