Do not hack on volatile loads. I'm not sure what the point of a volatile load
authorChris Lattner <sabre@nondot.org>
Mon, 12 Jan 2004 04:13:56 +0000 (04:13 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 12 Jan 2004 04:13:56 +0000 (04:13 +0000)
from constant memory is, but lets not take chances.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10765 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index dad78ac81c69f660e1f445219009d90dbef14e97..74433d616e81cca76e86489e17e266bc8c97935d 100644 (file)
@@ -2064,6 +2064,8 @@ static Constant *GetGEPGlobalInitializer(Constant *C, ConstantExpr *CE) {
 
 Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
   Value *Op = LI.getOperand(0);
+  if (LI.isVolatile()) return 0;
+
   if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Op))
     Op = CPR->getValue();