diff --git a/bpred.c b/bpred.c index d41f827..62969cc 100644 --- a/bpred.c +++ b/bpred.c @@ -966,7 +966,9 @@ bpred_update(struct bpred_t *pred, /* branch predictor instance */ /* update state (but not for jumps) */ if (dir_update_ptr->pdir1) { - char pred_cutoff = (pred->dirpred.bimod->class == BPred3bit) ? 7 : 3; + struct bpred_dir_t* p1 = + pred->dirpred.bimod ? pred->dirpred.bimod : pred->dirpred.twolev; + char pred_cutoff = (p1->class == BPred3bit) ? 7 : 3; if (taken) { if (*dir_update_ptr->pdir1 < pred_cutoff) @@ -983,6 +985,7 @@ bpred_update(struct bpred_t *pred, /* branch predictor instance */ /* second direction predictor */ if (dir_update_ptr->pdir2) { + /* Assumption: second predictor is always two-level. */ char pred_cutoff = (pred->dirpred.twolev->class == BPred3bit) ? 7 : 3; if (taken) {