[llvm-commits] [llvm] r52243 - in /llvm/trunk: lib/Transforms/Scalar/TailDuplication.cpp test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll
Evan Cheng
evan.cheng at apple.com
Thu Jun 12 13:55:40 PDT 2008
Author: evancheng
Date: Thu Jun 12 15:55:39 2008
New Revision: 52243
URL: http://llvm.org/viewvc/llvm-project?rev=52243&view=rev
Log:
Revert 52223.
Modified:
llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp
llvm/trunk/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll
Modified: llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp?rev=52243&r1=52242&r2=52243&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp Thu Jun 12 15:55:39 2008
@@ -33,7 +33,6 @@
#include "llvm/Support/Debug.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/Analysis/LoopInfo.h"
#include <map>
using namespace llvm;
@@ -51,12 +50,10 @@
static char ID; // Pass identification, replacement for typeid
TailDup() : FunctionPass((intptr_t)&ID) {}
- virtual void getAnalysisUsage(AnalysisUsage &AU) const;
private:
inline bool shouldEliminateUnconditionalBranch(TerminatorInst *, unsigned);
inline void eliminateUnconditionalBranch(BranchInst *BI);
SmallPtrSet<BasicBlock*, 4> CycleDetector;
- LoopInfo *LI; // The current loop information
};
}
@@ -72,9 +69,6 @@
/// a place it already pointed to earlier; see PR 2323.
bool TailDup::runOnFunction(Function &F) {
bool Changed = false;
-
- LI = &getAnalysis<LoopInfo>();
-
CycleDetector.clear();
for (Function::iterator I = F.begin(), E = F.end(); I != E; ) {
if (shouldEliminateUnconditionalBranch(I->getTerminator(),
@@ -89,10 +83,6 @@
return Changed;
}
-void TailDup::getAnalysisUsage(AnalysisUsage &AU) const {
- AU.addRequired<LoopInfo>();
-}
-
/// shouldEliminateUnconditionalBranch - Return true if this branch looks
/// attractive to eliminate. We eliminate the branch if the destination basic
/// block has <= 5 instructions in it, not counting PHI nodes. In practice,
@@ -196,14 +186,6 @@
if (!CycleDetector.insert(Dest))
return false;
- // Avoid non-natural loops:
- // If a loop header is duplicated, the former natural loop will contain two
- // paths into the loop --> the loop it not natural anymore. We want to avoid
- // this, because other optimizaions may fail to improve the loop because of
- // this.
- if (LI->isLoopHeader(Dest))
- return false;
-
return true;
}
Modified: llvm/trunk/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll?rev=52243&r1=52242&r2=52243&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll (original)
+++ llvm/trunk/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll Thu Jun 12 15:55:39 2008
@@ -1,5 +1,5 @@
-; RUN: llvm-as < %s | opt -tailduplicate -taildup-threshold=3 -stats -disable-output |& \
-; RUN: not grep tailduplicate
+; RUN: llvm-as < %s | opt -tailduplicate -taildup-threshold=3 -stats -disable-output | not grep tailduplicate
+; XFAIL: *
define i32 @foo(i32 %l) nounwind {
entry:
More information about the llvm-commits
mailing list