diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-05-25 05:53:04 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-05-25 05:53:04 +0000 |
commit | 124bdb7497e65f6606635e8ca7adbab0dd2ce07e (patch) | |
tree | 06e9d61c621ed0d0ede1d109580cf18948a7c2f6 /llvm/lib/Transforms/IPO/FunctionAttrs.cpp | |
parent | 7c1841a55ed33792f14f96eb2a2f4dc030bd99c2 (diff) | |
download | bcm5719-llvm-124bdb7497e65f6606635e8ca7adbab0dd2ce07e.tar.gz bcm5719-llvm-124bdb7497e65f6606635e8ca7adbab0dd2ce07e.zip |
[FunctionAttrs] Volatile loads should disable readonly
A volatile load has side effects beyond what callers expect readonly to
signify. For example, it is not safe to reorder two function calls
which each perform a volatile load to the same memory location.
llvm-svn: 270671
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionAttrs.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp index b6ebc632636..c757eb327d0 100644 --- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp @@ -463,6 +463,11 @@ determinePointerReadAttrs(Argument *A, } case Instruction::Load: + // A volatile load has side effects beyond what readonly can be relied + // upon. + if (cast<LoadInst>(I)->isVolatile()) + return Attribute::None; + IsRead = true; break; |