TORONTO -- Simon Pegg says his upcoming onscreen collaboration with Robin Williams will be imbued with a different tone following the beloved comedian's recent suicide.

In the Terry Jones-directed "Absolutely Anything," Pegg plays an embittered teacher who's suddenly granted the ability to do whatever he wants. In a strictly vocal role, Williams plays Pegg's dog in what is being considered his final performance.

In an interview at the Toronto International Film Festival on Saturday, Pegg confirmed that Williams had completed his work on the 2015 film before he died -- and also mused on the different emotions the film may now evoke in light of what happened.

"There'll be a degree of sadness in the movie now that wouldn't have been there had he been alive," said the 44-year-old Pegg, friendly even after enduring an early-morning flight from Morocco, where he was shooting "Mission: Impossible 5."

"But the fact is, he died. I'm still glad he's in the film and that the sadness that that brings will be a part of the movie now -- that can only be a good thing because he needs to be remembered."

Pegg was juggling promotional double duty at the Toronto fest, given that he stars both in the earnest philosophical travelogue "Hector and the Search For Happiness" and the hard-nosed thriller "Kill Me Three Times."

He lamented that he actually never met Williams while making "Absolutely Anything," the cast of which includes Kate Beckinsale and Eddie Izzard alongside "Monty Python" vets Michael Palin, Eric Idle, Terry Gilliam, Terry Jones and John Cleese.

"I didn't have any direct contact with Robin, sadly," said the star of "Shaun of the Dead" and "Star Trek."

"It's going to be forever a sad thing to me because I've loved him forever, since I was a kid, watching him in 'Mork & Mindy.' And I remember delighting seeing his movie career starting even when I was really young and wanting it to work -- he did 'Popeye,' he did a few misfires, and suddenly he got the accolades he deserved."

And though Pegg was reluctant to suggest anything positive could come from the "devastating" situation, he did hope it would help people to understand what Williams was going through.

"There's nothing good in the situation that he eventually found himself in but I hope it makes people understand that you can have access to the kind of material stuff that he did have access to as a supposedly rich, famous person and still be unhappy," Pegg said.

"That kind of depression affects anybody. It's completely without prejudice."