The embodiment of the invention provides an instruction optimization method and device,
electronic equipment and a readable medium, and relates to the technical field of computers, in the method, a symbol extension instruction in a to-be-optimized code serves as a to-be-optimized instruction. Acquiring a
data dependency chain corresponding to a function to which the to-be-optimized instruction belongs as a target dependency chain; the
data dependency chain is used for defining
data dependency instructions of all variables in the function. And searching a source instruction corresponding to the source
operand of the to-be-optimized instruction from the target dependency chain, and taking the source instruction as a source instruction of the to-be-optimized instruction. Under the condition that all the source instructions of the to-be-optimized instruction have symbol extension behaviors, determining the pre-extension
data bits corresponding to all the source instructions, and determining the pre-extension
data bits corresponding to the to-be-optimized instruction. And on the basis of the pre-extension
data bits corresponding to the source instructions and the pre-extension data bits corresponding to the to-be-optimized instruction, the to-be-optimized instruction is simplified, and the generated symbol extension instruction is optimized.