[llvm] r254456 - IR: Clean up some duplicated code in ConstantDataSequential creation. NFC

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 14:11:33 PST 2015


"Duncan P. N. Exon Smith" <dexonsmith at apple.com> writes:
>> On 2015-Dec-01, at 12:20, Justin Bogner via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>> 
>> Author: bogner
>> Date: Tue Dec  1 14:20:49 2015
>> New Revision: 254456
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=254456&view=rev
>> Log:
>> IR: Clean up some duplicated code in ConstantDataSequential creation. NFC
 ...
>> +  if (ConstantDataSequential::isElementTypeCompatible(C->getType()))
>
> Do you need this check, or can you just return all the time?
>
> (Same question for `ConstantVector::getImpl()`.)

It'd be functionally identical to skip the check and return, but I think
it's a bit more readable / matching these functions' style as is. 

>> +    return getSequenceIfElementsMatch<ConstantDataArray>(C, V);
>> 
>>   // Otherwise, we really do want to create a ConstantArray.
>>   return nullptr;


More information about the llvm-commits mailing list