mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 19:43:44 +00:00
interp: improve scan for loads
During a scan, consider loads from dirty globals to be dirty and check whether they have any local side effects. This fixes a problem with the new volatile operations that are now in methods on registers instead of being emitted inline as volatile instructions.
This commit is contained in:
committed by
Ron Evans
parent
f94af9f61e
commit
5342d392aa
+10
-1
@@ -109,7 +109,16 @@ func (e *Eval) hasSideEffects(fn llvm.Value) *sideEffectResult {
|
||||
default:
|
||||
panic("unreachable")
|
||||
}
|
||||
case llvm.Load, llvm.Store:
|
||||
case llvm.Load:
|
||||
if inst.IsVolatile() {
|
||||
result.updateSeverity(sideEffectLimited)
|
||||
}
|
||||
if _, ok := e.dirtyGlobals[inst.Operand(0)]; ok {
|
||||
if e.hasLocalSideEffects(dirtyLocals, inst) {
|
||||
result.updateSeverity(sideEffectLimited)
|
||||
}
|
||||
}
|
||||
case llvm.Store:
|
||||
if inst.IsVolatile() {
|
||||
result.updateSeverity(sideEffectLimited)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user