From 124bdb7497e65f6606635e8ca7adbab0dd2ce07e Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 25 May 2016 05:53:04 +0000 Subject: [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 --- llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/Transforms') 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(I)->isVolatile()) + return Attribute::None; + IsRead = true; break; -- cgit v1.2.3