[llvm-commits] [llvm] r126077 - in /llvm/trunk: lib/Transforms/Utils/Local.cpp test/Transforms/LoopStrengthReduce/pr2570.ll unittests/Transforms/Utils/Local.cpp

Dan Gohman gohman at apple.com
Mon Feb 21 08:36:35 PST 2011


On Feb 20, 2011, at 1:08 AM, Duncan Sands wrote:

> Hi Nick,
> 
>> -bool
>> -llvm::RecursivelyDeleteDeadPHINode(PHINode *PN) {
>> +bool llvm::RecursivelyDeleteDeadPHINode(PHINode *PN) {
>>    // We can remove a PHI if it is on a cycle in the def-use graph
>>    // where each node in the cycle has degree one, i.e. only one use,
>>    // and is an instruction with no side effects.
>> -  if (!PN->hasOneUse())
>> +  if (!areAllUsesEqual(PN))
>>      return false;
> 
> I know that it is not the fault of this patch, but it looks like
> RecursivelyDeleteDeadPHINode will not delete phi nodes that have no uses.
> Isn't that silly?

Not really.  Instcombine does a fine job deleting instructions with
no uses already, and the two users of this function, indvars and lsr,
don't create trivially dead phis.

Dan




More information about the llvm-commits mailing list