[llvm-commits] [llvm] r126088 - in /llvm/trunk: lib/Transforms/Utils/Local.cpp test/CodeGen/X86/codegen-dce.ll unittests/Transforms/Utils/Local.cpp

Duncan Sands baldrick at free.fr
Sun Feb 20 10:12:29 PST 2011


Hi Nick,

> Make RecursivelyDeleteDeadPHINode delete a phi node that has no users and add a
> test for that. With this change, test/CodeGen/X86/codegen-dce.ll no longer finds
> any instructions to DCE, so delete the test.
>
> Also renamed J and JP to I and IP in RecursivelyDeleteDeadPHINode.
>
> Removed:
>      llvm/trunk/test/CodeGen/X86/codegen-dce.ll
> Modified:
>      llvm/trunk/lib/Transforms/Utils/Local.cpp
>      llvm/trunk/unittests/Transforms/Utils/Local.cpp
>
> Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=126088&r1=126087&r2=126088&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
> +++ llvm/trunk/lib/Transforms/Utils/Local.cpp Sun Feb 20 12:05:56 2011
> @@ -283,6 +283,11 @@
>   /// delete it.  If that makes any of its operands trivially dead, delete them
>   /// too, recursively.  Return true if the PHI node is actually deleted.
>   bool llvm::RecursivelyDeleteDeadPHINode(PHINode *PN) {
> +  if (PN->use_empty()) {
> +    PN->eraseFromParent();
> +    return true;
> +  }
> +

rather than doing this, or as well as doing this, how about having
AreAllUsesEqual return true when there are no uses (which would be
more logical anyway)?

Ciao, Duncan.



More information about the llvm-commits mailing list