summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-01-13 23:01:57 +0000
committerSanjay Patel <spatel@rotateright.com>2016-01-13 23:01:57 +0000
commit9913322327833d25ad52528167208e282155e439 (patch)
treed644157eaa24a2ed472ec0001b74a6e64a5b2d13 /llvm/lib
parentaab986f873327cebc8582f2bd5a2d5dbbb8ae221 (diff)
downloadbcm5719-llvm-9913322327833d25ad52528167208e282155e439.tar.gz
bcm5719-llvm-9913322327833d25ad52528167208e282155e439.zip
move return variable declarations down to where they are actually used; NFCI
llvm-svn: 257700
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 8923ff74253..b866b25db4b 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -310,14 +310,12 @@ bool llvm::sinkRegion(DomTreeNode *N, AliasAnalysis *AA, LoopInfo *LI,
DT != nullptr && CurLoop != nullptr && CurAST != nullptr &&
SafetyInfo != nullptr && "Unexpected input to sinkRegion");
- // Set changed as false.
- bool Changed = false;
- // Get basic block
BasicBlock *BB = N->getBlock();
// If this subregion is not in the top level loop at all, exit.
- if (!CurLoop->contains(BB)) return Changed;
+ if (!CurLoop->contains(BB)) return false;
// We are processing blocks in reverse dfo, so process children first.
+ bool Changed = false;
const std::vector<DomTreeNode*> &Children = N->getChildren();
for (DomTreeNode *Child : Children)
Changed |= sinkRegion(Child, AA, LI, DT, TLI, CurLoop, CurAST, SafetyInfo);
@@ -366,14 +364,15 @@ bool llvm::hoistRegion(DomTreeNode *N, AliasAnalysis *AA, LoopInfo *LI,
assert(N != nullptr && AA != nullptr && LI != nullptr &&
DT != nullptr && CurLoop != nullptr && CurAST != nullptr &&
SafetyInfo != nullptr && "Unexpected input to hoistRegion");
- // Set changed as false.
- bool Changed = false;
- // Get basic block
+
BasicBlock *BB = N->getBlock();
+
// If this subregion is not in the top level loop at all, exit.
- if (!CurLoop->contains(BB)) return Changed;
+ if (!CurLoop->contains(BB)) return false;
+
// Only need to process the contents of this block if it is not part of a
// subloop (which would already have been processed).
+ bool Changed = false;
if (!inSubLoop(BB, CurLoop, LI))
for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E; ) {
Instruction &I = *II++;
@@ -883,14 +882,13 @@ bool llvm::promoteLoopAccessesToScalars(AliasSet &AS,
CurLoop != nullptr && CurAST != nullptr &&
SafetyInfo != nullptr &&
"Unexpected Input to promoteLoopAccessesToScalars");
- // Initially set Changed status to false.
- bool Changed = false;
+
// We can promote this alias set if it has a store, if it is a "Must" alias
// set, if the pointer is loop invariant, and if we are not eliminating any
// volatile loads or stores.
if (AS.isForwardingAliasSet() || !AS.isMod() || !AS.isMustAlias() ||
AS.isVolatile() || !CurLoop->isLoopInvariant(AS.begin()->getValue()))
- return Changed;
+ return false;
assert(!AS.empty() &&
"Must alias set should have at least one pointer element in it!");
@@ -925,6 +923,7 @@ bool llvm::promoteLoopAccessesToScalars(AliasSet &AS,
// Check that all of the pointers in the alias set have the same type. We
// cannot (yet) promote a memory location that is loaded and stored in
// different sizes. While we are at it, collect alignment and AA info.
+ bool Changed = false;
for (AliasSet::iterator ASI = AS.begin(), E = AS.end(); ASI != E; ++ASI) {
Value *ASIV = ASI->getValue();
PointerMustAliases.insert(ASIV);
OpenPOWER on IntegriCloud