[llvm-commits] [llvm] r122677 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp

Nick Lewycky nicholas at mxc.ca
Sun Jan 2 11:19:33 PST 2011


On 01/02/2011 02:27 AM, Frits van Bommel wrote:
> On Sun, Jan 2, 2011 at 3:46 AM, Nick Lewycky<nicholas at mxc.ca>  wrote:
>> +// RemoveUsers - For each instruction used by the value, Remove() the function
>> +// that contains the instruction. This should happen right before a call to RAUW.
>> +void MergeFunctions::RemoveUsers(Value *V) {
>> +  for (Value::use_iterator UI = V->use_begin(), UE = V->use_end();
>> +       UI != UE; ++UI) {
>> +    Use&U = UI.getUse();
>> +    if (Instruction *I = dyn_cast<Instruction>(U.getUser())) {
>> +      Remove(I->getParent()->getParent());
>> +    }
>> +  }
>>   }
>
> This doesn't handle uses in constant expressions, which can also make
> two functions suddenly compare equal when they change.

Thanks! I didn't need it in the case where we only update direct callers 
but forgot to add it after some refactoring.

Nick



More information about the llvm-commits mailing list