summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2015-10-09 16:11:45 +0000
committerTom Stellard <thomas.stellard@amd.com>2015-10-15 15:40:44 +0000
commit0543959ccd4d0efb6d9ab0307fd348550a5ffdd6 (patch)
tree5074e2f92bafe5eadc832e91f3297737b63fee04
parent180a9d8a7c4a81bc2f104fb11b32db87ff27bbff (diff)
XXX: StructCFG disable
-rw-r--r--include/llvm/Transforms/Scalar.h2
-rw-r--r--lib/Transforms/Scalar/StructurizeCFG.cpp17
2 files changed, 14 insertions, 5 deletions
diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h
index 5c703966eb1..57da5f5ae3f 100644
--- a/include/llvm/Transforms/Scalar.h
+++ b/include/llvm/Transforms/Scalar.h
@@ -262,7 +262,7 @@ FunctionPass *createFlattenCFGPass();
//
// CFG Structurization - Remove irreducible control flow
//
-Pass *createStructurizeCFGPass();
+Pass *createStructurizeCFGPass(bool *DisablePass = nullptr);
//===----------------------------------------------------------------------===//
//
diff --git a/lib/Transforms/Scalar/StructurizeCFG.cpp b/lib/Transforms/Scalar/StructurizeCFG.cpp
index 28812a45719..800664b3aac 100644
--- a/lib/Transforms/Scalar/StructurizeCFG.cpp
+++ b/lib/Transforms/Scalar/StructurizeCFG.cpp
@@ -161,6 +161,8 @@ public:
/// consist of a network of PHI nodes where the true incoming values expresses
/// breaks and the false values expresses continue states.
class StructurizeCFG : public RegionPass {
+ bool *DisablePass;
+
Type *Boolean;
ConstantInt *BoolTrue;
ConstantInt *BoolFalse;
@@ -236,7 +238,14 @@ public:
static char ID;
StructurizeCFG() :
- RegionPass(ID) {
+ RegionPass(ID),
+ DisablePass(nullptr) {
+ initializeStructurizeCFGPass(*PassRegistry::getPassRegistry());
+ }
+
+ StructurizeCFG(bool *DisablePass) :
+ RegionPass(ID),
+ DisablePass(DisablePass) {
initializeStructurizeCFGPass(*PassRegistry::getPassRegistry());
}
@@ -916,7 +925,7 @@ void StructurizeCFG::rebuildSSA() {
/// \brief Run the transformation for each region found
bool StructurizeCFG::runOnRegion(Region *R, RGPassManager &RGM) {
- if (R->isTopLevelRegion())
+ if (R->isTopLevelRegion() || (DisablePass && *DisablePass))
return false;
Func = R->getEntry()->getParent();
@@ -948,6 +957,6 @@ bool StructurizeCFG::runOnRegion(Region *R, RGPassManager &RGM) {
}
/// \brief Create the pass
-Pass *llvm::createStructurizeCFGPass() {
- return new StructurizeCFG();
+Pass *llvm::createStructurizeCFGPass(bool *DisablePass) {
+ return new StructurizeCFG(DisablePass);
}