/// isLoopInvariant - Return true if the specified value is loop invariant
///
bool isLoopInvariant(Value *V) const;
-
+
//===--------------------------------------------------------------------===//
// APIs for simple analysis of the loop.
//
///
Value *getTripCount() const;
+ /// isLCSSAForm - Return true if the Loop is in LCSSA form
+ bool isLCSSAForm() const;
+
//===--------------------------------------------------------------------===//
// APIs for updating loop information after changing the CFG
//
return 0;
}
+/// isLCSSAForm - Return true if the Loop is in LCSSA form
+bool Loop::isLCSSAForm() const {
+ for (Loop::block_iterator BB = block_begin(), E = block_end();
+ BB != E; ++BB) {
+ for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); I != E; ++I)
+ for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E;
+ ++UI) {
+ BasicBlock *UserBB = cast<Instruction>(*UI)->getParent();
+ if (!isa<PHINode>(*UI) && !contains(UserBB)) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
//===-------------------------------------------------------------------===//
// APIs for updating loop information after changing the CFG
for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) {
changed |= visitSubloop(*I);
}
-
+
return changed;
}
processInstruction(*I, exitBlocks);
}
+ assert(L->isLCSSAForm());
+
return true;
}