summaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/LoopInfo.cpp')
-rw-r--r--llvm/lib/Analysis/LoopInfo.cpp22
1 files changed, 5 insertions, 17 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp
index 6ba6073cce95..a8c3173bb179 100644
--- a/llvm/lib/Analysis/LoopInfo.cpp
+++ b/llvm/lib/Analysis/LoopInfo.cpp
@@ -58,26 +58,14 @@ static cl::opt<bool, true>
// Loop implementation
//
-bool Loop::isLoopInvariant(const Value *V, bool HasCoroSuspendInst) const {
- if (const Instruction *I = dyn_cast<Instruction>(V)) {
- // FIXME: this is semantically inconsistent. We're tracking a proper fix in
- // issue #149604.
- // If V is a pointer to stack object and L contains a coro.suspend function
- // call, then V may not be loop invariant because the ramp function and
- // resume function have different stack frames.
- if (HasCoroSuspendInst && isa<AllocaInst>(I))
- return false;
- else
- return !contains(I);
- }
+bool Loop::isLoopInvariant(const Value *V) const {
+ if (const Instruction *I = dyn_cast<Instruction>(V))
+ return !contains(I);
return true; // All non-instructions are loop invariant
}
-bool Loop::hasLoopInvariantOperands(const Instruction *I,
- bool HasCoroSuspendInst) const {
- return all_of(I->operands(), [&](Value *V) {
- return isLoopInvariant(V, HasCoroSuspendInst);
- });
+bool Loop::hasLoopInvariantOperands(const Instruction *I) const {
+ return all_of(I->operands(), [&](Value *V) { return isLoopInvariant(V); });
}
bool Loop::makeLoopInvariant(Value *V, bool &Changed, Instruction *InsertPt,