[PATCH] Fix for CodeGenPrepare wrongly updating the map of sunk addresses

Andrea_DiBiagio at sn.scee.net Andrea_DiBiagio at sn.scee.net
Fri May 3 09:28:05 PDT 2013


Hi Nick,


Nick Lewycky <nicholas at mxc.ca> wrote on 03/05/2013 16:23:15:
> Instead of building your own CallbackVH, would using a ValueMap work? If 

> not, I'd really like to see a generalized way to create the equivalent 
> of DenseMap<WeakVH<...>, ...>.

Yes it definitely work! Thanks for the advice.
Actually a ValueMap does exactly what I wanted to do using my custom 
CallbackVH.
Also, using ValueMap makes the patch simpler and definitely less verbose.

You can find the updated patch in attachment.

P.s.: As a side note,
the reason why I intially adopted that solution is because there are other 
places in LLVM
(not many to be honest) where custom CallbackVH are used as key of 
DenseMap to solve my same problem
but in different contexts.
An example is class AliasSetTracker (llvm/Analysis/AliasSetTracker.h) 
which defines a
nested class ASTCallbackVH as extension of CallbackVH.
Probably it would be a good idea if in the future we clean some old code 
where we use DenseMap + custom CallbackVH 
in place of ValueMap. But that is clearly out of the scope of this patch 
:).



Thanks!
-- Andrea Di Biagio


**********************************************************************
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. 
If you have received this email in error please notify postmaster at scee.net
This footnote also confirms that this email message has been checked for 
all known viruses.
Sony Computer Entertainment Europe Limited
Registered Office: 10 Great Marlborough Street, London W1F 7LP, United 
Kingdom
Registered in England: 3277793
**********************************************************************

P Please consider the environment before printing this e-mail
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-codegen-prepare.diff
Type: application/octet-stream
Size: 3213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130503/7f06cdb0/attachment.obj>


More information about the llvm-commits mailing list