Patch to BitcodeReader

Joe Abbey joe.abbey at gmail.com
Thu Sep 12 14:14:19 PDT 2013


Tom, 

This all looks good please review my updates to your patch for LLVM coding style.

Joe

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tweaked_ce_select.patch
Type: application/octet-stream
Size: 1797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130912/6b04092b/attachment.obj>
-------------- next part --------------


On Sep 12, 2013, at 5:10 PM, Tobias Grosser <tobias at grosser.es> wrote:

> On 09/12/2013 11:03 PM, Tom Roeder wrote:
>> Here's a version with a comment and the fixed CHECK statement.
> 
> Nice.
> 
> Just a tiny comment I overlooked before:
> 
>> Index: lib/Bitcode/Reader/BitcodeReader.cpp
>> ===================================================================
>> --- lib/Bitcode/Reader/BitcodeReader.cpp	(revision 190562)
>> +++ lib/Bitcode/Reader/BitcodeReader.cpp	(working copy)
>> @@ -1389,11 +1389,23 @@
>>      }
>>      case bitc::CST_CODE_CE_SELECT:  // CE_SELECT: [opval#, opval#, opval#]
>>        if (Record.size() < 3) return Error("Invalid CE_SELECT record");
>> -      V = ConstantExpr::getSelect(
>> -                          ValueList.getConstantFwdRef(Record[0],
>> -                                                      Type::getInt1Ty(Context)),
>> -                          ValueList.getConstantFwdRef(Record[1],CurTy),
>> -                          ValueList.getConstantFwdRef(Record[2],CurTy));
>> +
>> +      // If CurTy is a vector of length n, then Record[0] must be a <n x i1>
>> +      // vector. Otherwise, it must be a single bit.
>> +      if (VectorType *VTy = dyn_cast<VectorType>(CurTy)) {
>> +        unsigned int EltCount = VTy->getNumElements();
>> +        Type *SelectorTy = VectorType::get(Type::getInt1Ty(Context), EltCount);
>> +
>> +        V = ConstantExpr::getSelect(ValueList.getConstantFwdRef(Record[0],
>> +                                                                SelectorTy),
>> +                                    ValueList.getConstantFwdRef(Record[1],CurTy),
>> +                                    ValueList.getConstantFwdRef(Record[2],CurTy));
>> +      } else {
>> +        V = ConstantExpr::getSelect(ValueList.getConstantFwdRef(Record[0],
>> +                                                                Type::getInt1Ty(Context)),
>> +                                  ValueList.getConstantFwdRef(Record[1],CurTy),
>> +                                  ValueList.getConstantFwdRef(Record[2],CurTy));
> 
>                                     ^^ Those lines are not properly
>                                        aligned.
> 
> Otherwise, the patch looks good. Can you commit this patch yourself or do you need me to commit it?
> 
> Cheers,
> Tobias
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list