From 7310c68e857b8f9f3094695775d7ce3a7708cfe5 Mon Sep 17 00:00:00 2001 From: Igor Laevsky Date: Wed, 18 Nov 2015 14:50:18 +0000 Subject: Revert "Revert "Strip metadata when speculatively hoisting instructions (r252604)" Failing clang test is now fixed by the r253458. llvm-svn: 253459 --- llvm/lib/Analysis/LoopInfo.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'llvm/lib/Analysis') diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index 9ee72361c92..e679b7ad7b8 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; } -- cgit v1.2.3