diff --git a/tests/alive-tv/asm/load.srctgt.ll b/tests/alive-tv/asm/load.srctgt.ll new file mode 100644 index 000000000..ff2f5c612 --- /dev/null +++ b/tests/alive-tv/asm/load.srctgt.ll @@ -0,0 +1,13 @@ +target datalayout = "e-i64:64" + +@g = external global i64 + +define i64 @src() { + %1 = load i64, ptr @g, align 16 + ret i64 %1 +} + +define i64 @tgt() { + %1 = load i64, ptr @g + ret i64 %1 +} diff --git a/tools/transform.cpp b/tools/transform.cpp index 35a2135fd..616cc4e8e 100644 --- a/tools/transform.cpp +++ b/tools/transform.cpp @@ -1133,6 +1133,9 @@ static void calculateAndInitConstants(Transform &t) { if (!does_int_mem_access && !does_ptr_mem_access && has_fncall) does_int_mem_access = true; + if (does_int_mem_access && t.tgt.has(FnAttrs::Asm)) + does_ptr_mem_access = true; + auto has_attr = [&](ParamAttrs::Attribute a) -> bool { for (auto fn : { &t.src, &t.tgt }) { for (auto &v : fn->getInputs()) {