As someone who's worked as a lumberjack, I'm quite surprised at the answers here: I think everyone is imagining one-on-one duels between people dressed in plate armor, for which, admittedly, they might be poor because of their weight, one-handed balance, inability to parry well and inability to slice through metal.
But given to your front line, against a force who lacked them, it would be devastating.
Chainsaws are deadly. They are the most deadly tool you can use without a license.
They wound about thirty thousand people a year in the US alone. The wounds take an average of a hundred and ten stitches. That's when not trying to cut people up with it. About two hundred and fifty people a year die from them.
Consider two spear-and-pole-wielding lines meeting, but one is equipped with spears, the other pole-saws.
The spears get mostly deflected by the shields. The pole-saws slice right through all the leather armor and felt padding and wooden shields and other nonsense. They meet a surface they can't penetrate, the pole saws actively grab onto it, pull it to one side, and crawl around it.
Yes, you'd need a secondary weapon. But the majority of the foe's front line now needs an average of 110 stitches. You've struck terror into their hearts and nobody wants to step up to the meatgrinding machine that is your front line.
Chainsaws are an excellent tool, then, for massacres of lightly armored foes by a heavily organized force.
But they come with a downside: they are the most deadly tool you can use without a license, because they mostly maim the user. The whole "moving of their own accord to find they way past any impenetrable armor" thing can work against you, too: they kick back, they leap up into your face and neck, or down into your own leg. Pole saws are safer, but only to an extent.
Perhaps the most effective way to use them, then, would be using a formation like the Roman turtle, but with either pole saws, or a flap in the shield to push a chainsaw through, clamped in place such that the chainsaw cannot buck and twist in the hands of the wielder enough to slice himself or his comrades, and the wielder can use both hands to steady it and the shield together.
Combat is an arms race, though. Just as loggers now wear fibrous trousers to prevent injury from chainsaws, so people would start to wear heavy fibrous clothing to tangle the saws, and they would also clad their shields in it.
But arms races only have so much speed. The initial introduction of them could be enough to win a war.
[Edit: From pluckedKiwi's comments, I realize that polesaws are not known to everyone. A polesaw is a chainsaw with a pole between the engine and the blade, rather than placing a regular chainsaw on the end of a stick. This gives you balance: the weight of the engine and fuel tank (or motor and battery) near and behind your hand, counterbalances the length of the shaft and the weight of the blade at the end, arguably balancing better than a spear. However, it's still a decently heavy piece of kit.
I still think regular chainsaws mounted behind shields in turtle formation would be the best plan to use them. However, the lack of range compared to any missile weapon of the same size and weight does make them kinda silly.
Combat modifications to the blade (larger teeth; separating each tooth by two or three empty links as is used when cutting stone; faster chain replacement with a sprung blade instead of bolt tightening) would certainly help. As would ablative armor for the wielders to protect them from kickback.
If the question were "what modern stuff other than guns could make a medieval army really fricken deadly" I might not even bother mentioning chainsaws. Better armor would get my first vote. But given the question, yes, chainsaws would give your front line a crushing advantage. Rather than just being a consumable, disposable mass of bodies to absorb (or make) a waved attack, they'd be a death machine, grinding through flesh with a speed the opponents had never imagined. Sure, any missile weapon beats them. One gatling gun could best your entire army of chainsaw wielders. So would a line of bowmen with longbows.
But in medieval days, the tank of the day was the armored horse. A charge of trained horse-riding knights who've been trained their whole life, against a chainsaw turtle with a month's training... despite the very significant problems of armor penetration, particularly as the science of making plate armor got better, my money's on the turtle.]