mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
If a function does a volatile load from a global constant, do not
consider it to be readonly. In fact, don't even consider it to be readonly if it does a volatile load from an AllocaInst either (it is debatable as to whether readonly would be correct or not in this case; play safe for the moment). This fixes PR8279. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117783 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4aaf59d8ed
commit
ad6f541840
@ -188,12 +188,12 @@ bool FunctionAttrs::AddReadAttrs(const CallGraphSCC &SCC) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
|
} else if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
|
||||||
// Ignore loads from local memory.
|
// Ignore non-volatile loads from local memory.
|
||||||
if (PointsToLocalMemory(LI->getPointerOperand()))
|
if (!LI->isVolatile() && PointsToLocalMemory(LI->getPointerOperand()))
|
||||||
continue;
|
continue;
|
||||||
} else if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
|
} else if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
|
||||||
// Ignore stores to local memory.
|
// Ignore non-volatile stores to local memory.
|
||||||
if (PointsToLocalMemory(SI->getPointerOperand()))
|
if (!SI->isVolatile() && PointsToLocalMemory(SI->getPointerOperand()))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
test/Transforms/FunctionAttrs/2010-10-30-volatile.ll
Normal file
10
test/Transforms/FunctionAttrs/2010-10-30-volatile.ll
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
; RUN: opt < %s -functionattrs -S | FileCheck %s
|
||||||
|
; PR8279
|
||||||
|
|
||||||
|
@g = constant i32 1
|
||||||
|
|
||||||
|
define void @foo() {
|
||||||
|
; CHECK: void @foo() {
|
||||||
|
%tmp = volatile load i32* @g
|
||||||
|
ret void
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user