#include "llvm/Analysis/Dominators.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/CFG.h"
-#include "llvm/Support/Streams.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include <algorithm>
// Test if the value is already loop-invariant.
if (isLoopInvariant(I))
return true;
- // Don't hoist instructions with side-effects.
- if (I->isTrapping())
+ if (!I->isSafeToSpeculativelyExecute())
return false;
- // Don't hoist PHI nodes.
- if (isa<PHINode>(I))
- return false;
- // Don't hoist allocation instructions.
- if (isa<AllocationInst>(I))
+ if (I->mayReadFromMemory())
return false;
// Determine the insertion point, unless one was given.
if (!InsertPt) {
AU.setPreservesAll();
AU.addRequired<DominatorTree>();
}
+
+void LoopInfo::print(raw_ostream &OS, const Module*) const {
+ LI.print(OS);
+}
+