Do not hoist volatile loads
llvm-svn: 8399
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index f2cf68b..4940566 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -316,7 +316,7 @@
void LICM::visitLoadInst(LoadInst &LI) {
- if (isLoopInvariant(LI.getOperand(0)) &&
+ if (isLoopInvariant(LI.getOperand(0)) && !LI.isVolatile() &&
!pointerInvalidatedByLoop(LI.getOperand(0)) && SafeToHoist(LI)) {
hoist(LI);
++NumHoistedLoads;