aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-04-29 18:47:38 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2011-04-29 18:47:38 +0000
commit616044acd5b0920ed0cc40930b5d7dbcebca480c (patch)
tree23bc7c98a181abc03eb1f05088a99215d636ca28 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parente3511e15e0b933a16352fc263e98f479e6f76cfd (diff)
downloadllvm-616044acd5b0920ed0cc40930b5d7dbcebca480c.zip
llvm-616044acd5b0920ed0cc40930b5d7dbcebca480c.tar.gz
llvm-616044acd5b0920ed0cc40930b5d7dbcebca480c.tar.bz2
SimplifyCFG: Expose phi node folding cost threshold as command line parameter
llvm-svn: 130528
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index e0125f7..18b8573 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -37,6 +37,10 @@
#include <map>
using namespace llvm;
+static cl::opt<unsigned>
+PHINodeFoldingThreshold("phi-node-folding-threshold", cl::Hidden, cl::init(1),
+ cl::desc("Control the amount of phi node folding to perform (default = 1)"));
+
static cl::opt<bool>
DupRet("simplifycfg-dup-ret", cl::Hidden, cl::init(false),
cl::desc("Duplicate return instructions into unconditional branches"));
@@ -1246,7 +1250,8 @@ static bool FoldTwoEntryPHINode(PHINode *PN, const TargetData *TD) {
// instructions. While we are at it, keep track of the instructions
// that need to be moved to the dominating block.
SmallPtrSet<Instruction*, 4> AggressiveInsts;
- unsigned MaxCostVal0 = 1, MaxCostVal1 = 1;
+ unsigned MaxCostVal0 = PHINodeFoldingThreshold,
+ MaxCostVal1 = PHINodeFoldingThreshold;
for (BasicBlock::iterator II = BB->begin(); isa<PHINode>(II);) {
PHINode *PN = cast<PHINode>(II++);