[llvm-commits] [llvm] r80358 - in /llvm/trunk/lib/Transforms/Instrumentation: MaximumSpanningTree.cpp MaximumSpanningTree.h

Chris Lattner clattner at apple.com
Sun Aug 30 10:53:39 PDT 2009


On Aug 30, 2009, at 1:52 AM, Andreas Neustifter wrote:
>> Hi Andreas,
>>
>>> +  // compare two weighted edges
>>> +  struct VISIBILITY_HIDDEN EdgeWeightCompare {
>>> +    bool operator()(const ProfileInfo::EdgeWeight X,
>>> +                    const ProfileInfo::EdgeWeight Y) const {
>>> +      if (X.second > Y.second) return true;
>>> +      if (X.second < Y.second) return false;
>>> +#ifndef NDEBUG
>>
>> Why does this predicate depend on whether assertions are enabled or
>> not?  That sounds like a potential source of really insidious bugs.
>
> The plan is to have the debug output as stable as possible to be  
> able to
> compare it to output from previous runs. The weight of the edge
> (X.second, Y.second) is the only part thats really necessary, the part
> in the predicated tries to ensure stable sorting of edges of the same
> weight.
>
> But if your experience tells you that this may lead to complications I
> will remove it.

I don't have a strong opinion, it just looks scary :).  Daniel, what  
do you think?

-Chris



More information about the llvm-commits mailing list