From 75a2db813395e577d844d0996b4528010ee09e1d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 29 Jan 2008 19:01:37 +0000 Subject: Don't let globalopt hack on volatile loads or stores. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46523 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/GlobalOpt.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index ea8080e..7bed9e2 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -163,12 +163,15 @@ static bool AnalyzeGlobal(Value *V, GlobalStatus &GS, else if (GS.AccessingFunction != F) GS.HasMultipleAccessingFunctions = true; } - if (isa(I)) { + if (LoadInst *LI = dyn_cast(I)) { GS.isLoaded = true; + if (LI->isVolatile()) return true; // Don't hack on volatile loads. } else if (StoreInst *SI = dyn_cast(I)) { // Don't allow a store OF the address, only stores TO the address. if (SI->getOperand(0) == V) return true; + if (SI->isVolatile()) return true; // Don't hack on volatile stores. + // If this is a direct store to the global (i.e., the global is a scalar // value, not an aggregate), keep more specific information about // stores. -- cgit v1.1