[llvm-commits] [llvm] r122716 - in /llvm/trunk: lib/Transforms/Scalar/EarlyCSE.cpp lib/Transforms/Scalar/LoopIdiomRecognize.cpp test/Transforms/EarlyCSE/basic.ll

Chris Lattner sabre at nondot.org
Sun Jan 2 17:06:27 PST 2011


On Jan 2, 2011, at 4:02 PM, Frits van Bommel wrote:

> On Mon, Jan 3, 2011 at 12:19 AM, Chris Lattner <sabre at nondot.org> wrote:
>> +  else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) {
>> +    Res = getHash(CI->getOperand(0));
>> +    for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i)
>> +      Res ^= getHash(CI->getOperand(i)) << i;
>> +  } else if (CmpInst *CI = dyn_cast<CmpInst>(Inst)) {
>> +      Res = getHash(CI->getOperand(0)) ^ (getHash(CI->getOperand(1)) << 1) ^
>> +         CI->getPredicate();
>> +  } else {
>> +    assert((isa<SelectInst>(Inst) || isa<ExtractElementInst>(Inst) ||
>> +            isa<InsertElementInst>(Inst) || isa<ShuffleVectorInst>(Inst) ||
>> +            isa<ExtractValueInst>(Inst) || isa<InsertValueInst>(Inst)) &&
>> +           "Unhandled instruction kind");
>> +    Res = getHash(CI->getType()) << 4;
>> +    for (unsigned i = 0, e = Inst->getNumOperands(); i != e; ++i)
>> +      Res ^= getHash(CI->getOperand(i)) << i;
>> +  }
> 
> ExtractValue/InsertValue indices aren't operands, so they're not taken
> into account here.

Good point, I'll fix this so they don't hash to the same thing.

> Also, it might make sense to simplify the code by handling operands
> more generically instead of duplicating the code in each if clause.

This is a work in progress.

>> +// This could regognize common matrix multiplies and dot product idioms and
>> +// replace them with calls to BLAS (if linked in??).
> 
> s/regognize/recognize/

Thanks.

-Chris



More information about the llvm-commits mailing list