Do not hoist volatile loads
authorChris Lattner <sabre@nondot.org>
Mon, 8 Sep 2003 18:17:14 +0000 (18:17 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 8 Sep 2003 18:17:14 +0000 (18:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8399 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LICM.cpp

index f2cf68b4e9c880778bed7c2237fd57d72227a775..4940566b2a75ca46151c629425ff039fe9bc17e5 100644 (file)
@@ -316,7 +316,7 @@ bool LICM::SafeToHoist(Instruction &Inst) {
 
 
 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;