diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-01-29 19:01:37 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-01-29 19:01:37 +0000 |
| commit | ade0abb4987e28ce5203850a244c4b0af29569c7 (patch) | |
| tree | ef24fe4794bcae8b7d542242bcf1825e25ac2ad3 /llvm/lib/Transforms | |
| parent | ddb1dd8c5fdd1023ba2006a38370d5358ce1e91b (diff) | |
| download | bcm5719-llvm-ade0abb4987e28ce5203850a244c4b0af29569c7.tar.gz bcm5719-llvm-ade0abb4987e28ce5203850a244c4b0af29569c7.zip | |
Don't let globalopt hack on volatile loads or stores.
llvm-svn: 46523
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index ea8080e35e8..7bed9e22d11 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/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<LoadInst>(I)) { + if (LoadInst *LI = dyn_cast<LoadInst>(I)) { GS.isLoaded = true; + if (LI->isVolatile()) return true; // Don't hack on volatile loads. } else if (StoreInst *SI = dyn_cast<StoreInst>(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. |

