1. A computer program product for implementing a scan chain to test a semiconductor, the computer program product comprising: a computer readable storage medium having program instructions embodied therewith, wherein the computer readable storage medium is not a transitory signal per se, the program instructions executable by a computer to cause the computer to perform a method comprising: obtaining, by the computer, an initial structure of the scan chain; determining, by the computer, according to function modules of the semiconductor corresponding to scan registers on the scan chain, at least one scan register pair with backward dependency; and adjusting, by the computer, the initial structure of the scan chain such that the at least one scan register pair with backward dependency becomes a scan register pair with forward dependency; and determining, by the computer, a key subset of a fan-out scan register in the at least one scan register pair with backward dependency, wherein a fan-in scan register in the at least one scan register pair with backward dependency belongs to the key subset of the fan-out scan register, wherein logic values of all fan-in scan registers in the key subset of the fan-out scan register and a logic value of an output of a function module connected to the fan-out scan register are the same, no matter which logic values are taken by fan-in scan registers outside the key subset of the fan-out scan register.