def test_autodebug_bitcode(self):
    if (self.is_wasm_backend() and ('-flto' not in self.get_emcc_args())):
        return self.skipTest('must use bitcode object files for bitcode autodebug')
    self.emcc_args += ['--llvm-opts', '0']

    def do_autodebug(filename):
        building.llvm_dis((filename + '.o'), (filename + '.ll'))
        run_process([PYTHON, AUTODEBUGGER, (filename + '.ll'), (filename + '.auto.ll')])
        self.prep_ll_file(filename, (filename + '.auto.ll'), force_recompile=True)
    test_path = path_from_root('tests', 'core', 'test_structs')
    src = (test_path + '.c')
    output = (test_path + '.out')
    self.do_run_from_file(src, output, build_ll_hook=(lambda x: False))
    filename = 'src.c'
    do_autodebug(filename)
    self.do_ll_run((filename + '.auto.ll'), 'AD:-1,1')
    src = '\n        #include <stdio.h>\n\n        char cache[256], *next = cache;\n\n        int main()\n        {\n          cache[10] = 25;\n          next[20] = 51;\n          int x = cache[10];\n          double y = 11.52;\n          printf("*%d,%d,%.2f*\\n", x, cache[20], y);\n          return 0;\n        }\n      '
    self.do_run(src, 'AD:-1,1', build_ll_hook=do_autodebug)
def test_autodebug_bitcode(self):
    if (self.is_wasm_backend() and ('-flto' not in self.get_emcc_args())):
        return self.skipTest('must use bitcode object files for bitcode autodebug')
    self.emcc_args += ['--llvm-opts', '0']

    def do_autodebug(filename):
        building.llvm_dis((filename + '.o'), (filename + '.ll'))
        run_process([PYTHON, AUTODEBUGGER, (filename + '.ll'), (filename + '.auto.ll')])
        self.prep_ll_file(filename, (filename + '.auto.ll'), force_recompile=True)
    test_path = path_from_root('tests', 'core', 'test_structs')
    src = (test_path + '.c')
    output = (test_path + '.out')
    self.do_run_from_file(src, output, build_ll_hook=(lambda x: False))
    filename = 'src.c'
    do_autodebug(filename)
    self.do_ll_run((filename + '.auto.ll'), 'AD:-1,1')
    src = '\n        #include <stdio.h>\n\n        char cache[256], *next = cache;\n\n        int main()\n        {\n          cache[10] = 25;\n          next[20] = 51;\n          int x = cache[10];\n          double y = 11.52;\n          printf("*%d,%d,%.2f*\\n", x, cache[20], y);\n          return 0;\n        }\n      '
    self.do_run(src, 'AD:-1,1', build_ll_hook=do_autodebug)