Diabetes is associated with HCC; however, the impact of longitudinal blood glucose (BG) control on HCC risk in cirrhosis is not well known. We investigated this knowledge gap in a cohort of United States Veterans with cirrhosis from 2015 to 2021. We used repeated hemoglobin A1c measurements to categorize follow-up time according to BG control (defined as hemoglobin A1c < 7%) state over time: uncontrolled, nonsustained control (≤2 y), or sustained control (>2 y). We performed a sensitivity analysis using hemoglobin A1c < 8% to define BG control. We used Fine and Gray Cox proportional hazards regression with death and transplant as competing events to compare rates of incident HCC. Our study included 81,907 individuals, 56.2% of whom had diabetes at baseline. There were 8,002 incident HCCs. The rate of HCC was 18% higher in diabetes (95% CI: 13% - 24%), and the relative increase in the rate of HCC varied by etiology of cirrhosis from nonsignificant (HCV) to an increase of 120% (HBV). Uncontrolled and nonsustained BG control was associated with 1.80 (95% CI: 1.70-1.91) and 2.34 (95% CI: 2.21-2.48) times the rate of HCC compared to sustained BG control, respectively. Using Hgb A1c < 8% to define BG control, HCC rates in uncontrolled and nonsustained BG control were 2.43 (2.28-2.58) and 2.23 (2.11-2.36) times that observed in sustained BG control. Associations between diabetes and HCC in cirrhosis vary according to the longitudinal BG control state. Inadequate BG control is consistently associated with a higher risk of HCC, and long-term BG control should be considered in comprehensive cirrhosis care.