[Polly][PATCH] Use reference to clarify pointer can never be null

Tobias Grosser tobias at grosser.es
Sat Apr 18 07:11:43 PDT 2015


On 04/18/2015 03:58 PM, Johannes Doerfert wrote:
>> -const ScopDetection::BoxedLoopsSetTy *
>> +const ScopDetection::BoxedLoopsSetTy &
>>   ScopDetection::getBoxedLoops(const Region *R) const {
>> -  auto BLMIt = BoxedLoopsMap.find(R);
>> -  if (BLMIt == BoxedLoopsMap.end())
>> -    return nullptr;
>> -  return &BLMIt->second;
>> +  return BoxedLoopsMap.find(R)->second;
>>   }
> Are you sure the access of ->second is actually legal if find returns
> BoxedLoopsMap.end() ?

My understanding is that we will have such a map for each region that we 
detect. Hence, .find(R) should always be successful.

Did I miss something?

Best,
Tobias




More information about the llvm-commits mailing list