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

Nick Lewycky nicholas at mxc.ca
Sun Feb 20 01:12:23 PST 2011


On 02/20/2011 01: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?

Yes it absolutely is. I thought it was only being called from a function 
that was already deleting zero-use instructions, but this is actually 
part of Local's public API.

You can wait for me to patch it tomorrow or do it now yourself :)

Nick



More information about the llvm-commits mailing list