aboutsummaryrefslogtreecommitdiff
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.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp
index 9ee7236..e679b7a 100644
--- a/llvm/lib/Analysis/LoopInfo.cpp
+++ b/llvm/lib/Analysis/LoopInfo.cpp
@@ -120,6 +120,13 @@ bool Loop::makeLoopInvariant(Instruction *I, bool &Changed,
// Hoist.
I->moveBefore(InsertPt);
+
+ // There is possibility of hoisting this instruction above some arbitrary
+ // condition. Any metadata defined on it can be control dependent on this
+ // condition. Conservatively strip it here so that we don't give any wrong
+ // information to the optimizer.
+ I->dropUnknownNonDebugMetadata();
+
Changed = true;
return true;
}