From 6edf4f898f9342fe7f81feb2fab56744272b97e8 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 6 Jun 2015 22:56:53 -0700 Subject: [PATCH] Gracefully skipping noaccess constant loads. --- src/xenia/cpu/compiler/passes/constant_propagation_pass.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xenia/cpu/compiler/passes/constant_propagation_pass.cc b/src/xenia/cpu/compiler/passes/constant_propagation_pass.cc index 2923ce4b5..b92b5997a 100644 --- a/src/xenia/cpu/compiler/passes/constant_propagation_pass.cc +++ b/src/xenia/cpu/compiler/passes/constant_propagation_pass.cc @@ -188,18 +188,19 @@ bool ConstantPropagationPass::Run(HIRBuilder* builder) { auto heap = memory->LookupHeap(address); uint32_t protect; if (heap->QueryProtect(address, &protect) && - !(protect & kMemoryProtectWrite)) { + !(protect & kMemoryProtectWrite) && + (protect & kMemoryProtectRead)) { // Memory is readonly - can just return the value. switch (v->type) { case INT32_TYPE: v->set_constant(xe::load_and_swap( memory->TranslateVirtual(address))); + i->Remove(); break; default: assert_unhandled_case(v->type); break; } - i->Remove(); } } }