Browse Source

Fix segmentation fault.

master
Danila Fedorin 1 year ago
parent
commit
6994ea0046
  1. 5
      bpred.c

5
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)
{

Loading…
Cancel
Save