diff options
| -rw-r--r-- | sparse-llvm.c | 6 | ||||
| -rw-r--r-- | validation/backend/store-x2.c | 16 |
2 files changed, 18 insertions, 4 deletions
diff --git a/sparse-llvm.c b/sparse-llvm.c index 7c8e1bff..c83911a1 100644 --- a/sparse-llvm.c +++ b/sparse-llvm.c @@ -651,16 +651,14 @@ static void output_op_load(struct function *fn, struct instruction *insn) static void output_op_store(struct function *fn, struct instruction *insn) { - LLVMValueRef addr, target, target_in; + LLVMValueRef addr, target_in; addr = calc_memop_addr(fn, insn); target_in = pseudo_to_value(fn, insn, insn->target); /* perform store */ - target = LLVMBuildStore(fn->builder, target_in, addr); - - insn->target->priv = target; + LLVMBuildStore(fn->builder, target_in, addr); } static LLVMValueRef bool_value(struct function *fn, LLVMValueRef value) diff --git a/validation/backend/store-x2.c b/validation/backend/store-x2.c new file mode 100644 index 00000000..5ccc9b43 --- /dev/null +++ b/validation/backend/store-x2.c @@ -0,0 +1,16 @@ +void foo(int *p, int a, int b); +void foo(int *p, int a, int b) +{ + int c = a + b; + + p[0] = c; + p[1] = c; +} + +/* + * check-name: store-x2 + * check-command: sparsec -c $file -o tmp.o + * check-description: Verify in output_op_store() that + * the first store doesn't mess anymore with the + * 'target' and thus making the second store unusable. + */ |
