Skip to content

Commit

Permalink
initial attempt to fix bug in opt when local values have their addres…
Browse files Browse the repository at this point in the history
…s taken
  • Loading branch information
dibyendumajumdar committed Aug 5, 2018
1 parent e418752 commit fe8e4d5
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion dmr_c/omrjit-backend/sparse-omrjit.c
Expand Up @@ -25,7 +25,7 @@

/*
Define environment variable
TR_Options=traceIlGen,traceFull,log=trtrace.log
TR_Options=traceIlGen,traceFull,traceAliases,log=trtrace.log
To obtain a nice trace of codegen
*/

Expand Down Expand Up @@ -780,6 +780,15 @@ static JIT_NodeRef output_op_store(struct dmr_C *C, struct function *fn, struct
}
}

/* Following causes test failures -- To be investgated */
//if (insn->src->type == PSEUDO_SYM) {
// JIT_SymbolRef symref = get_sym_value(C, fn, insn->src, true);
// if (symref && JIT_IsTemporary(fn->injector, symref)) {
// JIT_StoreToTemporary(fn->injector, symref, target_in);
// return target_in;
// }
//}

ptr = pseudo_to_value(C, fn, insn->type, insn->src);
if (!ptr)
return NULL;
Expand Down Expand Up @@ -1471,11 +1480,20 @@ static JIT_NodeRef output_op_symaddr(struct dmr_C *C, struct function *fn, struc
{
JIT_NodeRef res, src;
struct OMRType *dtype;
JIT_SymbolRef sym;

src = pseudo_to_value(C, fn, insn->type, insn->symbol);
if (!src)
return NULL;

/* We need to tell the backend if a local var has had its
address taken */
if (insn->symbol->type == PSEUDO_SYM) {
sym = get_sym_value(C, fn, insn->symbol, true);
if (sym)
JIT_SetAutoAddressTaken(fn->injector, sym);
}

dtype = get_symnode_or_basetype(C, fn, insn->type);
if (!dtype)
return NULL;
Expand Down

0 comments on commit fe8e4d5

Please sign in to comment.