aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--Documentation/IR.md2
-rw-r--r--linearize.h7
-rw-r--r--sparse-llvm.c2
3 files changed, 5 insertions, 6 deletions
diff --git a/Documentation/IR.md b/Documentation/IR.md
index b9749dff..7bbeda8f 100644
--- a/Documentation/IR.md
+++ b/Documentation/IR.md
@@ -12,7 +12,7 @@ The common ones are:
- .src: (pseudo_t) operand of unary ops (alias for .src1).
- .target: (pseudo_t) result of unary, binary & ternary ops, is sometimes used
otherwise by some others instructions.
-- .cond: (pseudo_t) input operands for condition (alias .target!)
+- .cond: (pseudo_t) input operands for condition (alias .src/.src1)
- .type: (symbol*) usually the type of .result, sometimes of the operands
### Terminators
diff --git a/linearize.h b/linearize.h
index 5162e6c2..840b29c8 100644
--- a/linearize.h
+++ b/linearize.h
@@ -73,18 +73,17 @@ struct instruction {
struct basic_block *bb;
struct position pos;
struct symbol *type;
- union {
- pseudo_t target;
- pseudo_t cond; /* for branch and switch */
- };
+ pseudo_t target;
union {
struct /* entrypoint */ {
struct pseudo_list *arg_list;
};
struct /* branch */ {
+ pseudo_t cond;
struct basic_block *bb_true, *bb_false;
};
struct /* switch */ {
+ pseudo_t _cond;
struct multijmp_list *multijmp_list;
};
struct /* phi_node */ {
diff --git a/sparse-llvm.c b/sparse-llvm.c
index a9475a84..b34decda 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -793,7 +793,7 @@ static void output_op_switch(struct function *fn, struct instruction *insn)
def = jmp->target;
} END_FOR_EACH_PTR(jmp);
- sw_val = get_ioperand(fn, insn->type, insn->target);
+ sw_val = get_ioperand(fn, insn->type, insn->cond);
target = LLVMBuildSwitch(fn->builder, sw_val,
def ? def->priv : NULL, n_jmp);