The pair worked together on new film Filth, which also stars Jim Broadbent and Jamie Bell, and is based on Welsh's "unfilmable" third book.
Welsh told the Radio Times that while making Filth, he discussed the subject of sexual abuse with X-Men star McAvoy, who apparently told him: "If you ever write a script about it, I'd love to play Jimmy Savile."
In Welsh's 1996 collection Ecstasy, one of the stories, Lorraine Goes to Livingston, concerns Freddy Royle, a fictional children's TV presenter described as the nation's "favourite caring, laconic uncle", who turns out to be a child molester and necrophiliac, raising millions for the hospital where he commits his crimes.
The story was written over 15 years before Savile's crimes became public.
Asked whether the similarities were based on inside knowledge, Welsh told the Radio Times: "I had nothing to do with the hospital services, or NHS trusts, or the BBC.
"So how come I knew this rumour about Jimmy Savile, this eccentric British institution? There must have been so much stuff on the grapevine. But there was a whole culture then of not addressing these issues."
Welsh said that he was groped by middle-aged women when, as a student in the late 70s, he worked in a bingo hall.
He said that he believed such abusive behaviour was "all about power".
COMMENT RULES: Comments that are judged to be defamatory, abusive or in bad taste are not acceptable and contributors who consistently fall below certain criteria will be permanently blacklisted. The moderator will not enter into debate with individual contributors and the moderator’s decision is final. It is Belfast Telegraph policy to close comments on court cases, tribunals and active legal investigations. We may also close comments on articles which are being targeted for abuse. Problems with commenting? email@example.com
It's time to put plans into action. Don't wait for anyone's permission. Just move forward as if you've been given the green light. Before long, others will recognise the merit of this idea and lend their support. It will be especially helpful to get the approval of an educational leader. Making resources more readily available to the public is a worthwhile mission. You especially enjoy seeing children benefit from your hard work. Thanks to you, they'll have better opportunities for advancement.More