[LLVMdev] [lld] contentHash in the Reader ?

Nick Kledzik kledzik at apple.com
Wed May 8 15:00:53 PDT 2013


On May 8, 2013, at 12:54 PM, Shankar Easwaran <shankare at codeaurora.org> wrote:

> On 5/8/2013 2:45 PM, Nick Kledzik wrote:
>> 
>> I'd rather we use a crypto hash so we don't have to compare content at all.
>> The crypto hashes work well if the atom content is const data (e.g. c-string or other literals), since you just point the hash function at the range of bytes in the constant data.  Where it gets messier is if you are trying to coalesce non-leaf functions or non-const data because it is not just the content bytes that need to be compared but also all the references must somehow be incorporated into the hash. For example, two functions have the exact same instruction bytes, but one calls foo and one calls bar.
>> 
> I was thinking that we just do ICF for leaf functions only, non leaf functions can fold only if all the references end up calling the same targets isnt it ? (Which could result from templated code ?)

I'd like to be able to using the coalescing/folding mechanism for Objective-C data structures.  For instance if two translation units use the NSString literal @"hello", I'd like to merge the two data structures into one.    In ld64, I have a (non-crypto) content hash method along with an equality method on each atom.  The equality method the NSString literals checks that the two have the same data (sans pointers) and that pointers point to the same thing, using the same equality method.

-Nick




More information about the llvm-dev mailing list