A series of (BDD-X)n conjugated polymers, comprised of 5,7-bis(2-ethylhexyl)benzo[1,2-c:4,5-c ']dithiophene-4,8-dione (BDD) and X = B (P1), X = TBT (P2), and X = TBTBT (P3), where T = thiophene and B = benzo[c][1,2,5]thiadiazole, have been synthesized and applied as dopant-free hole-transport layer materials in perovskite solar cells (PSCs). We explored the effect of the molecular structure of the block X on the optical and electronic properties of the polymers, the nanoscale morphology of their films, and the impact of all these parameters on the performance of the polymers in PSCs. As a result, using the polymer P1 with the simplest molecular architecture provided a power conversion efficiency (PCE) of 20.1% in solar cells, thus outperforming devices assembled with the more sophisticated polymers P2-P3 or the reference poly(triarylamine)-based hole-transport materials. The enhanced device performance is attributed to a better HOMO alignment of P1 with respect to the perovskite valence band, a low concentration of defects and suppressed carrier recombination at the P1/perovskite interface and, most importantly, a highly uniform film structure, as revealed by atomic force microscopy and infrared scattering near-field optical microscopy (IR s-SNOM) techniques. The supramolecular interactions of the building blocks of polymers P1-P3 with the perovskite films, resulting in the passivation of surface defects, were further studied by density functional theory calculations.