From dcef55b2ef9d441a51f56347bc9c815e9cdb0cf7 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Thu, 19 Nov 2009 02:03:18 +0000 Subject: [PATCH] Eliminate duplicate phi nodes in loops. Loop rotation, for example, can introduce these, and it's beneficial to later passes to clean them up. llvm-svn: 89298 --- llvm/lib/Transforms/Utils/LoopSimplify.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp index 2ab097214958..44a2c1f85181 100644 --- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp +++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp @@ -305,6 +305,12 @@ ReprocessLoop: } } + // If there are duplicate phi nodes (for example, from loop rotation), + // get rid of them. + for (Loop::block_iterator BB = L->block_begin(), E = L->block_end(); + BB != E; ++BB) + EliminateDuplicatePHINodes(*BB); + return Changed; }