I tried to find any info about this. The only thing I found that is "The computer never researches weapon or armor upgrades. The only exception are computer-controlled units in the missions Medivh and Northshire Abbey, which begin the game with full upgrades." So theoretically does not make any difference in most of the case. But what happens in those 2 missions if we destroy Blacksmith? Will AI lose the ability to utilize the upgrades?
Shot answer: yes, AI player cannot upgrade without structures needed.
AI player make upgrades with the next logic.
Every level has special AI delay timer parameter for each building type.
AI will set delay timer for each building and wait. After delay elapsed, AI will try to perform an action for this building.
For barracks this will be unit creating.
For blacksmith this will be upgrade with the next logic: if Shields is lower then Swords upgrade shields else upgrade swords.
If there is no blacksmith, AI has no possibility to execute this procedure.
PS. As I can see AI is able to make upgrades in most of missions.