[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner clattner at apple.com
Fri Apr 27 20:52:02 PDT 2007


On Apr 27, 2007, at 8:44 PM, Nick Lewycky wrote:

> Chris Lattner wrote:
>> +          if (OrigBase) {
>> +            // If we were able to index down into an element,  
>> create the GEP
>> +            // and bitcast the result.  This eliminates one  
>> bitcast, potentially
>> +            // two.
>> +            Instruction *NGEP = new GetElementPtrInst(OrigBase,  
>> &NewIndices[0],
>> +                                                       
>> NewIndices.size(), "");
>> +            InsertNewInstBefore(NGEP, CI);
>> +            NGEP->takeName(GEP);
>> +
>> +            cerr << "\nZAP: " << *GEP->getOperand(0);
>> +            cerr << "ZAP: " << *GEP;
>> +            cerr << "ZAP: " << CI << "\n";
>> +
>> +            cerr << "NEW: " << *NGEP << "\n";
>>
> How rude! ;-)

holy crap batman.  Fixed.

>>      return 0;
>> -  } else if (isa<GetElementPtrInst>(V) ||
>> -             (isa<ConstantExpr>(V) &&
>> -              cast<ConstantExpr>(V)->getOpcode() 
>> ==Instruction::GetElementPtr)) {
>> -    User *GEPI = cast<User>(V);
>> +  } else if (User *GEPI = dyn_castGetElementPtr(V)) {
>>
> Did the email get mangled, or does it actually say that? cvsweb agrees
> with the email.

the diff is right.  dyn_castGetElementPtr is a helper function in  
instcombine.

-Chris



More information about the llvm-commits mailing list