[PATCH] D26992: [StructurizeCFG] Make hasOnlyUniformBranches a non-member function.
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 22 15:23:39 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL287716: [StructurizeCFG] Make hasOnlyUniformBranches a non-member function. (authored by jlebar).
Changed prior to commit:
https://reviews.llvm.org/D26992?vs=78936&id=78958#toc
Repository:
rL LLVM
https://reviews.llvm.org/D26992
Files:
llvm/trunk/lib/Transforms/Scalar/StructurizeCFG.cpp
Index: llvm/trunk/lib/Transforms/Scalar/StructurizeCFG.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/StructurizeCFG.cpp
+++ llvm/trunk/lib/Transforms/Scalar/StructurizeCFG.cpp
@@ -163,7 +163,6 @@
/// breaks and the false values expresses continue states.
class StructurizeCFG : public RegionPass {
bool SkipUniformRegions;
- DivergenceAnalysis *DA;
Type *Boolean;
ConstantInt *BoolTrue;
@@ -236,8 +235,6 @@
void rebuildSSA();
- bool hasOnlyUniformBranches(const Region *R);
-
public:
static char ID;
@@ -912,13 +909,14 @@
}
}
-bool StructurizeCFG::hasOnlyUniformBranches(const Region *R) {
+static bool hasOnlyUniformBranches(const Region *R,
+ const DivergenceAnalysis &DA) {
for (const BasicBlock *BB : R->blocks()) {
const BranchInst *Br = dyn_cast<BranchInst>(BB->getTerminator());
if (!Br || !Br->isConditional())
continue;
- if (!DA->isUniform(Br->getCondition()))
+ if (!DA.isUniform(Br->getCondition()))
return false;
DEBUG(dbgs() << "BB: " << BB->getName() << " has uniform terminator\n");
}
@@ -931,9 +929,9 @@
return false;
if (SkipUniformRegions) {
- DA = &getAnalysis<DivergenceAnalysis>();
// TODO: We could probably be smarter here with how we handle sub-regions.
- if (hasOnlyUniformBranches(R)) {
+ auto &DA = getAnalysis<DivergenceAnalysis>();
+ if (hasOnlyUniformBranches(R, DA)) {
DEBUG(dbgs() << "Skipping region with uniform control flow: " << *R << '\n');
// Mark all direct child block terminators as having been treated as
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26992.78958.patch
Type: text/x-patch
Size: 1667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161122/7ed1bc88/attachment.bin>
More information about the llvm-commits
mailing list